From fc044b94e565c0aa3a6d668c20fa90deb8760200 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Thu, 5 Mar 2020 08:24:46 -0500 Subject: [PATCH] evas_object_intercept: Reduce calls to efl_data_scope_get Small patch to reduce the number of calls to efl_data_scope_get as per mailing list discussion. Since the EVAS_OBJECT_INTERCEPT_CALLBACK_DEFINE macro already retrieves the protected data via efl_data_scope_get, we can just pass that protected data directly to evas_object_intercept_init/deinit functions without the need to refetch it. Differential Revision: https://phab.enlightenment.org/D11449 --- src/lib/evas/canvas/evas_object_intercept.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c index c4a4b44f51..298a76c74a 100644 --- a/src/lib/evas/canvas/evas_object_intercept.c +++ b/src/lib/evas/canvas/evas_object_intercept.c @@ -9,25 +9,20 @@ /* local calls */ -static void evas_object_intercept_init(Evas_Object *eo_obj); -static void evas_object_intercept_deinit(Evas_Object *eo_obj); +static void evas_object_intercept_init(Evas_Object_Protected_Data *obj); +static void evas_object_intercept_deinit(Evas_Object_Protected_Data *obj); static void -evas_object_intercept_init(Evas_Object *eo_obj) +evas_object_intercept_init(Evas_Object_Protected_Data *obj) { - Evas_Object_Protected_Data *obj; - - obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); if (!obj) return; - if (!obj->interceptors) obj->interceptors = calloc(1, sizeof(Evas_Intercept_Func)); } static void -evas_object_intercept_deinit(Evas_Object *eo_obj) +evas_object_intercept_deinit(Evas_Object_Protected_Data *obj) { - Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); if (!obj || !obj->interceptors) return; if ((obj->interceptors->show.func) || (obj->interceptors->hide.func) || @@ -270,7 +265,7 @@ _evas_object_intercept_call_evas(Evas_Object_Protected_Data *obj, MAGIC_CHECK_END(); \ Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); \ if (!func) return; \ - evas_object_intercept_init(eo_obj); \ + evas_object_intercept_init(obj); \ if (!obj->interceptors) return; \ obj->interceptors->Lower_Type.func = func; \ obj->interceptors->Lower_Type.data = (void *)data; \ @@ -291,7 +286,7 @@ _evas_object_intercept_call_evas(Evas_Object_Protected_Data *obj, obj->interceptors->Lower_Type.func = NULL; \ data = obj->interceptors->Lower_Type.data; \ obj->interceptors->Lower_Type.data = NULL; \ - evas_object_intercept_deinit(eo_obj); \ + evas_object_intercept_deinit(obj); \ return data; \ }