summaryrefslogtreecommitdiff
path: root/src
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 /src
parent284e30f700e4bf55df68a9e5e765a6f8747fd5f6 (diff)
Eo: Split object checking from class checking and simplify.
The check there was wrong for objects anyway, and was ultra conservative for classes.
Diffstat (limited to 'src')
-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 5f93561..4e6d2eb 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -142,18 +142,25 @@ _dich_func_clean_all(_Eo_Class *klass)
142 142
143/* END OF DICH */ 143/* END OF DICH */
144 144
145static inline Eina_Bool
146_eo_is_a_class(const Eo *eo_id)
147{
148 Eo_Id oid;
149#ifdef HAVE_EO_ID 145#ifdef HAVE_EO_ID
150 oid = (Eo_Id) eo_id; 146# define _EO_ID_GET(Id) ((Eo_Id) (Id))
151#else 147#else
152 /* fortunately EO_OBJ_POINTER_RETURN* will handle NULL eo_id */ 148# define _EO_ID_GET(Id) ((Eo_Id) ((Id) ? ((Eo_Header *) (Id))->id : 0))
153 if (!eo_id) return EINA_FALSE;
154 oid = ((Eo_Header *) eo_id)->id;
155#endif 149#endif
156 return (!(oid & MASK_OBJ_TAG) && (oid & MASK_CLASS_TAG)); 150
151
152static inline Eina_Bool
153_eo_is_a_obj(const Eo *eo_id)
154{
155 Eo_Id oid = (Eo_Id) _EO_ID_GET(eo_id);
156 return !!(oid & MASK_OBJ_TAG);
157}
158
159static inline Eina_Bool
160_eo_is_a_class(const Eo *eo_id)
161{
162 Eo_Id oid = (Eo_Id) _EO_ID_GET(eo_id);
163 return !!(oid & MASK_CLASS_TAG);
157} 164}
158 165
159static inline _Eo_Class * 166static inline _Eo_Class *
@@ -433,20 +440,20 @@ static inline Eina_Bool
433_eo_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id, 440_eo_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id,
434 Eina_Bool is_super, Eo_Stack_Frame *fptr) 441 Eina_Bool is_super, Eo_Stack_Frame *fptr)
435{ 442{
436 fptr->is_obj = !_eo_is_a_class(eo_id); 443 fptr->is_obj = _eo_is_a_obj(eo_id);
437 444
438 /* If we are already in the same object context, we inherit info from it. */ 445 /* If we are already in the same object context, we inherit info from it. */
439 if (!fptr->is_obj) 446 if (fptr->is_obj)
440 {
441 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE);
442 fptr->o.kls = _klass;
443 }
444 else
445 { 447 {
446 EO_OBJ_POINTER_RETURN_VAL(eo_id, _obj, EINA_FALSE); 448 EO_OBJ_POINTER_RETURN_VAL(eo_id, _obj, EINA_FALSE);
447 fptr->o.obj = _obj; 449 fptr->o.obj = _obj;
448 _eo_ref(_obj); 450 _eo_ref(_obj);
449 } 451 }
452 else
453 {
454 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE);
455 fptr->o.kls = _klass;
456 }
450 457
451 if (is_super) 458 if (is_super)
452 { 459 {
@@ -946,7 +953,7 @@ eo_class_name_get(const Eo_Class *eo_id)
946 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, NULL); 953 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, NULL);
947 klass = _klass; 954 klass = _klass;
948 } 955 }
949 else 956 else
950 { 957 {
951 EO_OBJ_POINTER_RETURN_VAL(eo_id, obj, NULL); 958 EO_OBJ_POINTER_RETURN_VAL(eo_id, obj, NULL);
952 klass = obj->klass; 959 klass = obj->klass;