summaryrefslogtreecommitdiff
path: root/src/lib/eo/eo.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-03-14 14:14:53 -0700
committerCedric BAIL <cedric.bail@free.fr>2019-03-27 15:03:18 -0700
commitadf4512a3520e942899ddd8c49bafcb39cb2a9b3 (patch)
tree0cb6a401462d0fe4f35f7d9bd6776218605f14f9 /src/lib/eo/eo.c
parentf11dfc0bc8b454f86edef29256bb3f3e4c322b2b (diff)
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/eo/eo.c')
-rw-r--r--src/lib/eo/eo.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index f1fbd37..c16c021 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,
384 return NULL; 384 return NULL;
385} 385}
386 386
387static inline void
388_apply_auto_unref(_Eo_Object *obj, const Eo *eo_obj)
389{
390 if (EINA_UNLIKELY(obj && obj->auto_unref))
391 {
392 if (obj->finalized && !(--obj->auto_unref))
393 efl_unref(eo_obj);
394 }
395}
396
387/************************************ EO ************************************/ 397/************************************ EO ************************************/
388 398
389static EFL_FUNC_TLS _Efl_Class *_super_klass = NULL; 399static EFL_FUNC_TLS _Efl_Class *_super_klass = NULL;
@@ -576,11 +586,7 @@ err_func_src:
576err: 586err:
577 if (is_obj) 587 if (is_obj)
578 { 588 {
579 if (EINA_UNLIKELY(obj->auto_unref != 0)) 589 _apply_auto_unref(obj, eo_id);
580 {
581 if (obj->finalized && !(--obj->auto_unref))
582 efl_unref(eo_id);
583 }
584 _efl_unref(obj); 590 _efl_unref(obj);
585 _eo_obj_pointer_done((Eo_Id)eo_id); 591 _eo_obj_pointer_done((Eo_Id)eo_id);
586 } 592 }
@@ -644,11 +650,7 @@ _efl_object_call_end(Efl_Object_Op_Call_Data *call)
644{ 650{
645 if (EINA_LIKELY(!!call->obj)) 651 if (EINA_LIKELY(!!call->obj))
646 { 652 {
647 if (EINA_UNLIKELY(call->obj->auto_unref != 0)) 653 _apply_auto_unref(call->obj, call->eo_id);
648 {
649 if (call->obj->finalized && !(--call->obj->auto_unref))
650 efl_unref(call->eo_id);
651 }
652 _efl_unref(call->obj); 654 _efl_unref(call->obj);
653 _eo_obj_pointer_done((Eo_Id)call->eo_id); 655 _eo_obj_pointer_done((Eo_Id)call->eo_id);
654 } 656 }
@@ -715,11 +717,7 @@ _efl_object_op_api_id_get(const void *api_func, const Eo *eo_obj, const char *ap
715 file, api_func_name, line, 717 file, api_func_name, line,
716 "Unable to resolve op for api func %p for obj=%p (%s)", 718 "Unable to resolve op for api func %p for obj=%p (%s)",
717 api_func, eo_obj, efl_class_name_get(eo_obj)); 719 api_func, eo_obj, efl_class_name_get(eo_obj));
718 if (EINA_UNLIKELY(obj && obj->auto_unref)) 720 _apply_auto_unref(obj, eo_obj);
719 {
720 if (obj->finalized && !(--obj->auto_unref))
721 efl_unref(eo_obj);
722 }
723 return EFL_NOOP; 721 return EFL_NOOP;
724 } 722 }
725 723