diff options
author | Tom Hacohen <tom@stosb.com> | 2015-10-16 10:08:33 +0100 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2015-10-19 10:22:41 +0100 |
commit | a7208ffd0099ae2625c9694004e2f9bd8a12a4cf (patch) | |
tree | b231546cd9c566daec7aa6c27d4e61f34185f7e5 | |
parent | 23f0c0852ecde31b41ea5c63b79e87b439a68533 (diff) | |
download | efl-a7208ffd0099ae2625c9694004e2f9bd8a12a4cf.tar.gz |
Eo: Reorganise some of the code and cleanup.
This is cleaner and makes more sense.
-rw-r--r-- | src/lib/eo/eo.c | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 89a50f65c9..7fa140660e 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -35,7 +35,6 @@ static void _eo_condtor_reset(_Eo_Object *obj); static inline void *_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass); static inline void *_eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Class *klass, const _Eo_Object *ref_obj); static inline void _eo_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj); -static const _Eo_Class *_eo_op_class_get(Eo_Op op); /* Start of Dich */ @@ -103,6 +102,30 @@ _dich_func_get(const _Eo_Class *klass, Eo_Op op) return &chain1->funcs[DICH_CHAIN_LAST(op)]; } +/* XXX: Only used for a debug message below. Doesn't matter that it's slow. */ +static const _Eo_Class * +_eo_op_class_get(Eo_Op op) +{ + _Eo_Class **itr = _eo_classes; + int mid, max, min; + + min = 0; + max = _eo_classes_last_id - 1; + while (min <= max) + { + mid = (min + max) / 2; + + if (itr[mid]->base_id + itr[mid]->desc->ops.count < op) + min = mid + 1; + else if (itr[mid]->base_id > op) + max = mid - 1; + else + return itr[mid]; + } + + return NULL; +} + static inline Eina_Bool _dich_func_set(_Eo_Class *klass, Eo_Op op, eo_op_func_type func) { @@ -173,30 +196,6 @@ _eo_class_pointer_get(const Eo_Class *klass_id) #endif } -static const _Eo_Class * -_eo_op_class_get(Eo_Op op) -{ - /* FIXME: Make it fast. */ - _Eo_Class **itr = _eo_classes; - int mid, max, min; - - min = 0; - max = _eo_classes_last_id - 1; - while (min <= max) - { - mid = (min + max) / 2; - - if (itr[mid]->base_id + itr[mid]->desc->ops.count < op) - min = mid + 1; - else if (itr[mid]->base_id > op) - max = mid - 1; - else - return itr[mid]; - } - - return NULL; -} - static const char * _eo_op_desc_name_get(const Eo_Op_Description *desc) { @@ -872,31 +871,29 @@ _eo_add_internal_end(Eo *eo_id, Eo_Call_Stack *stack) return NULL; } + if (!fptr->o.obj->condtor_done) { - if (!fptr->o.obj->condtor_done) - { - const _Eo_Class *klass = fptr->o.obj->klass; + const _Eo_Class *klass = fptr->o.obj->klass; - ERR("Object of class '%s' - Not all of the object constructors have been executed.", - klass->desc->name); - goto cleanup; - } + ERR("Object of class '%s' - Not all of the object constructors have been executed.", + klass->desc->name); + goto cleanup; + } - if (!eo_id) - { -// XXX: Given EFL usage of objects, construction is a perfectly valid thing -// to do. we shouldn't complain about it as handling a NULL obj creation is -// the job of the caller. a perfect example here is ecore_con and ecore_ipc -// where you create a con or ipc obj then set up type/destination/port and -// the finalize of the constructor does the actual connect and thus this -// fails or succeeds based on if service is there. -// -// until there is a better solution - don't complain here. -// -// ERR("Object of class '%s' - Finalizing the object failed.", -// klass->desc->name); - goto cleanup; - } + if (!eo_id) + { + // XXX: Given EFL usage of objects, construction is a perfectly valid thing + // to do. we shouldn't complain about it as handling a NULL obj creation is + // the job of the caller. a perfect example here is ecore_con and ecore_ipc + // where you create a con or ipc obj then set up type/destination/port and + // the finalize of the constructor does the actual connect and thus this + // fails or succeeds based on if service is there. + // + // until there is a better solution - don't complain here. + // + // ERR("Object of class '%s' - Finalizing the object failed.", + // klass->desc->name); + goto cleanup; } fptr->o.obj->finalized = EINA_TRUE; |