diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2019-03-14 14:14:53 -0700 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2019-03-27 15:03:18 -0700 |
commit | adf4512a3520e942899ddd8c49bafcb39cb2a9b3 (patch) | |
tree | 0cb6a401462d0fe4f35f7d9bd6776218605f14f9 /src/lib | |
parent | f11dfc0bc8b454f86edef29256bb3f3e4c322b2b (diff) | |
download | efl-adf4512a3520e942899ddd8c49bafcb39cb2a9b3.tar.gz |
eo: refactor auto_unref logic used by efl_part.
This bring no functional change to Eo and efl_part.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8357
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/eo/eo.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index f1fbd37fcf..c16c021ef2 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -384,6 +384,16 @@ _eo_kls_itr_next(const _Efl_Class *orig_kls, const _Efl_Class *cur_klass, return NULL; } +static inline void +_apply_auto_unref(_Eo_Object *obj, const Eo *eo_obj) +{ + if (EINA_UNLIKELY(obj && obj->auto_unref)) + { + if (obj->finalized && !(--obj->auto_unref)) + efl_unref(eo_obj); + } +} + /************************************ EO ************************************/ static EFL_FUNC_TLS _Efl_Class *_super_klass = NULL; @@ -576,11 +586,7 @@ err_func_src: err: if (is_obj) { - if (EINA_UNLIKELY(obj->auto_unref != 0)) - { - if (obj->finalized && !(--obj->auto_unref)) - efl_unref(eo_id); - } + _apply_auto_unref(obj, eo_id); _efl_unref(obj); _eo_obj_pointer_done((Eo_Id)eo_id); } @@ -644,11 +650,7 @@ _efl_object_call_end(Efl_Object_Op_Call_Data *call) { if (EINA_LIKELY(!!call->obj)) { - if (EINA_UNLIKELY(call->obj->auto_unref != 0)) - { - if (call->obj->finalized && !(--call->obj->auto_unref)) - efl_unref(call->eo_id); - } + _apply_auto_unref(call->obj, call->eo_id); _efl_unref(call->obj); _eo_obj_pointer_done((Eo_Id)call->eo_id); } @@ -715,11 +717,7 @@ _efl_object_op_api_id_get(const void *api_func, const Eo *eo_obj, const char *ap file, api_func_name, line, "Unable to resolve op for api func %p for obj=%p (%s)", api_func, eo_obj, efl_class_name_get(eo_obj)); - if (EINA_UNLIKELY(obj && obj->auto_unref)) - { - if (obj->finalized && !(--obj->auto_unref)) - efl_unref(eo_obj); - } + _apply_auto_unref(obj, eo_obj); return EFL_NOOP; } |