summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-15 12:56:15 +0100
committerTom Hacohen <tom@stosb.com>2015-10-19 10:22:41 +0100
commitb0576a04fd5a3e21dfc85298ec0c4c9969765a02 (patch)
tree25724510e26d1d61bf8ffc2100dfac8e3c12d95a
parent284e30f700e4bf55df68a9e5e765a6f8747fd5f6 (diff)
downloadefl-b0576a04fd5a3e21dfc85298ec0c4c9969765a02.tar.gz
Eo: Split object checking from class checking and simplify.
The check there was wrong for objects anyway, and was ultra conservative for classes.
-rw-r--r--src/lib/eo/eo.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 5f9356195b..4e6d2ebc08 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 *
@@ -433,20 +440,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)
{
@@ -946,7 +953,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;