summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-15 12:56:15 +0100
committerTom Hacohen <tom@stosb.com>2015-11-09 11:43:04 +0000
commitf7f7fc69cff9c573fa490eafd5233822e229ef5c (patch)
tree6fe7329d473859beff2a8abf919805c42787fc78
parentf7196513d04acd263425c69aafda4a3a02c574b4 (diff)
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 a3c9b74ce2..2742dc66fc 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 *
@@ -430,20 +437,20 @@ static inline Eina_Bool
430_eo_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id, 437_eo_do_internal(const Eo *eo_id, const Eo_Class *cur_klass_id,
431 Eina_Bool is_super, Eo_Stack_Frame *fptr) 438 Eina_Bool is_super, Eo_Stack_Frame *fptr)
432{ 439{
433 fptr->is_obj = !_eo_is_a_class(eo_id); 440 fptr->is_obj = _eo_is_a_obj(eo_id);
434 441
435 /* If we are already in the same object context, we inherit info from it. */ 442 /* If we are already in the same object context, we inherit info from it. */
436 if (!fptr->is_obj) 443 if (fptr->is_obj)
437 {
438 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE);
439 fptr->o.kls = _klass;
440 }
441 else
442 { 444 {
443 EO_OBJ_POINTER_RETURN_VAL(eo_id, _obj, EINA_FALSE); 445 EO_OBJ_POINTER_RETURN_VAL(eo_id, _obj, EINA_FALSE);
444 fptr->o.obj = _obj; 446 fptr->o.obj = _obj;
445 _eo_ref(_obj); 447 _eo_ref(_obj);
446 } 448 }
449 else
450 {
451 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, EINA_FALSE);
452 fptr->o.kls = _klass;
453 }
447 454
448 if (is_super) 455 if (is_super)
449 { 456 {
@@ -986,7 +993,7 @@ eo_class_name_get(const Eo_Class *eo_id)
986 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, NULL); 993 EO_CLASS_POINTER_RETURN_VAL(eo_id, _klass, NULL);
987 klass = _klass; 994 klass = _klass;
988 } 995 }
989 else 996 else
990 { 997 {
991 EO_OBJ_POINTER_RETURN_VAL(eo_id, obj, NULL); 998 EO_OBJ_POINTER_RETURN_VAL(eo_id, obj, NULL);
992 klass = obj->klass; 999 klass = obj->klass;