discomfitor pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=53900d184a6f4f80009f23b6dff316005e961f1e
commit 53900d184a6f4f80009f23b6dff316005e961f1e Author: Mike Blumenkrantz <zm...@osg.samsung.com> Date: Tue Aug 4 19:48:11 2015 -0400 use pointer hash to track data manager resources --- src/bin/e_comp_wl.h | 2 +- src/bin/e_comp_wl_data.c | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h index 771389d..27c350c 100644 --- a/src/bin/e_comp_wl.h +++ b/src/bin/e_comp_wl.h @@ -183,7 +183,7 @@ struct _E_Comp_Wl_Data struct { struct wl_global *global; - Eina_List *data_resources; + Eina_Hash *data_resources; } mgr; struct diff --git a/src/bin/e_comp_wl_data.c b/src/bin/e_comp_wl_data.c index e620303..5d5e054 100644 --- a/src/bin/e_comp_wl_data.c +++ b/src/bin/e_comp_wl_data.c @@ -380,8 +380,7 @@ static const struct wl_data_device_interface _e_data_device_interface = static void _e_comp_wl_data_device_cb_unbind(struct wl_resource *resource) { - e_comp->wl_comp_data->mgr.data_resources = - eina_list_remove(e_comp->wl_comp_data->mgr.data_resources, resource); + eina_hash_del_by_key(e_comp->wl_comp_data->mgr.data_resources, &resource); } static void @@ -435,8 +434,7 @@ _e_comp_wl_data_manager_cb_device_get(struct wl_client *client, struct wl_resour return; } - e_comp->wl_comp_data->mgr.data_resources = - eina_list_append(e_comp->wl_comp_data->mgr.data_resources, res); + eina_hash_add(e_comp->wl_comp_data->mgr.data_resources, &client, res); wl_resource_set_implementation(res, &_e_data_device_interface, e_comp->wl_comp_data, _e_comp_wl_data_device_cb_unbind); } @@ -799,6 +797,7 @@ e_comp_wl_data_manager_init(void) /* create clipboard */ _e_comp_wl_clipboard_create(); + e_comp->wl_comp_data->mgr.data_resources = eina_hash_pointer_new(NULL); return EINA_TRUE; } @@ -810,19 +809,11 @@ e_comp_wl_data_manager_shutdown(void) /* if (e_comp->wl_comp_data->mgr.global) wl_global_destroy(e_comp->wl_comp_data->mgr.global); */ wl_list_remove(&e_comp->wl_comp_data->clipboard.listener.link); + E_FREE_FUNC(e_comp->wl_comp_data->mgr.data_resources, eina_hash_free); } EINTERN struct wl_resource * e_comp_wl_data_find_for_client(struct wl_client *client) { - Eina_List *l; - struct wl_resource *res; - - EINA_LIST_FOREACH(e_comp->wl_comp_data->mgr.data_resources, l, res) - { - if (wl_resource_get_client(res) == client) - return res; - } - - return NULL; + return eina_hash_find(e_comp->wl_comp_data->mgr.data_resources, &client); } --