tasn pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f7f7fc69cff9c573fa490eafd5233822e229ef5c
commit f7f7fc69cff9c573fa490eafd5233822e229ef5c Author: Tom Hacohen <t...@stosb.com> Date: Thu Oct 15 12:56:15 2015 +0100 Eo: Split object checking from class checking and simplify. The check there was wrong for objects anyway, and was ultra conservative for classes. --- src/lib/eo/eo.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index a3c9b74..2742dc6 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -142,18 +142,25 @@ _dich_func_clean_all(_Eo_Class *klass) /* END OF DICH */ -static inline Eina_Bool -_eo_is_a_class(const Eo *eo_id) -{ - Eo_Id oid; #ifdef HAVE_EO_ID - oid = (Eo_Id) eo_id; +# define _EO_ID_GET(Id) ((Eo_Id) (Id)) #else - /* fortunately EO_OBJ_POINTER_RETURN* will handle NULL eo_id */ - if (!eo_id) return EINA_FALSE; - oid = ((Eo_Header *) eo_id)->id; +# define _EO_ID_GET(Id) ((Eo_Id) ((Id) ? ((Eo_Header *) (Id))->id : 0)) #endif - return (!(oid & MASK_OBJ_TAG) && (oid & MASK_CLASS_TAG)); + + +static inline Eina_Bool +_eo_is_a_obj(const Eo *eo_id) +{ + Eo_Id oid = (Eo_Id) _EO_ID_GET(eo_id); + return !!(oid & MASK_OBJ_TAG); +} + +static inline Eina_Bool +_eo_is_a_class(const Eo *eo_id) +{ + Eo_Id oid = (Eo_Id) _EO_ID_GET(eo_id); + return !!(oid & MASK_CLASS_TAG); } static inline _Eo_Class * @@ -430,20 +437,20 @@ static inline Eina_Bool _eo_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id, Eina_Bool is_super, Eo_Stack_Frame *fptr) { - fptr->is_obj = !_eo_is_a_class(eo_id); + fptr->is_obj = _eo_is_a_obj(eo_id); /* If we are already in the same object context, we inherit info from it. */ - if (!fptr->is_obj) - { - EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE); - fptr->o.kls = _klass; - } - else + if (fptr->is_obj) { EO_OBJ_POINTER_RETURN_VAL(eo_id, _obj, EINA_FALSE); fptr->o.obj = _obj; _eo_ref(_obj); } + else + { + EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE); + fptr->o.kls = _klass; + } if (is_super) { @@ -986,7 +993,7 @@ eo_class_name_get(const Eo_Class *eo_id) EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, NULL); klass = _klass; } - else + else { EO_OBJ_POINTER_RETURN_VAL(eo_id, obj, NULL); klass = obj->klass; --