summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2015-10-16 10:08:33 +0100
committerTom Hacohen <tom@stosb.com>2015-11-09 11:43:04 +0000
commit6ed69b1d11b92cffbe121723842bcbf27ef4a182 (patch)
treee109314e823a2a2da1fca1a96b3afff6417f347e
parent3782931c505b467945e74f763c26270ffea39896 (diff)
Eo: Reorganise some of the code and cleanup.
This is cleaner and makes more sense.
-rw-r--r--src/lib/eo/eo.c91
1 files changed, 44 insertions, 47 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index 2dc5547d13..f305d75f14 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);
35static inline void *_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass); 35static inline void *_eo_data_scope_get(const _Eo_Object *obj, const _Eo_Class *klass);
36static inline void *_eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Class *klass, const _Eo_Object *ref_obj); 36static inline void *_eo_data_xref_internal(const char *file, int line, _Eo_Object *obj, const _Eo_Class *klass, const _Eo_Object *ref_obj);
37static inline void _eo_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj); 37static inline void _eo_data_xunref_internal(_Eo_Object *obj, void *data, const _Eo_Object *ref_obj);
38static const _Eo_Class *_eo_op_class_get(Eo_Op op);
39 38
40/* Start of Dich */ 39/* Start of Dich */
41 40
@@ -103,6 +102,30 @@ _dich_func_get(const _Eo_Class *klass, Eo_Op op)
103 return &chain1->funcs[DICH_CHAIN_LAST(op)]; 102 return &chain1->funcs[DICH_CHAIN_LAST(op)];
104} 103}
105 104
105/* XXX: Only used for a debug message below. Doesn't matter that it's slow. */
106static const _Eo_Class *
107_eo_op_class_get(Eo_Op op)
108{
109 _Eo_Class **itr = _eo_classes;
110 int mid, max, min;
111
112 min = 0;
113 max = _eo_classes_last_id - 1;
114 while (min <= max)
115 {
116 mid = (min + max) / 2;
117
118 if (itr[mid]->base_id + itr[mid]->desc->ops.count < op)
119 min = mid + 1;
120 else if (itr[mid]->base_id > op)
121 max = mid - 1;
122 else
123 return itr[mid];
124 }
125
126 return NULL;
127}
128
106static inline Eina_Bool 129static inline Eina_Bool
107_dich_func_set(_Eo_Class *klass, Eo_Op op, eo_op_func_type func) 130_dich_func_set(_Eo_Class *klass, Eo_Op op, eo_op_func_type func)
108{ 131{
@@ -173,30 +196,6 @@ _eo_class_pointer_get(const Eo_Class *klass_id)
173#endif 196#endif
174} 197}
175 198
176static const _Eo_Class *
177_eo_op_class_get(Eo_Op op)
178{
179 /* FIXME: Make it fast. */
180 _Eo_Class **itr = _eo_classes;
181 int mid, max, min;
182
183 min = 0;
184 max = _eo_classes_last_id - 1;
185 while (min <= max)
186 {
187 mid = (min + max) / 2;
188
189 if (itr[mid]->base_id + itr[mid]->desc->ops.count < op)
190 min = mid + 1;
191 else if (itr[mid]->base_id > op)
192 max = mid - 1;
193 else
194 return itr[mid];
195 }
196
197 return NULL;
198}
199
200static const char * 199static const char *
201_eo_op_desc_name_get(const Eo_Op_Description *desc) 200_eo_op_desc_name_get(const Eo_Op_Description *desc)
202{ 201{
@@ -921,31 +920,29 @@ _eo_add_internal_end(Eo *eo_id, Eo_Call_Stack *stack)
921 return NULL; 920 return NULL;
922 } 921 }
923 922
923 if (!fptr->o.obj->condtor_done)
924 { 924 {
925 if (!fptr->o.obj->condtor_done) 925 const _Eo_Class *klass = fptr->o.obj->klass;
926 {
927 const _Eo_Class *klass = fptr->o.obj->klass;
928 926
929 ERR("Object of class '%s' - Not all of the object constructors have been executed.", 927 ERR("Object of class '%s' - Not all of the object constructors have been executed.",
930 klass->desc->name); 928 klass->desc->name);
931 goto cleanup; 929 goto cleanup;
932 } 930 }
933 931
934 if (!eo_id) 932 if (!eo_id)
935 { 933 {
936// XXX: Given EFL usage of objects, construction is a perfectly valid thing 934 // XXX: Given EFL usage of objects, construction is a perfectly valid thing
937// to do. we shouldn't complain about it as handling a NULL obj creation is 935 // to do. we shouldn't complain about it as handling a NULL obj creation is
938// the job of the caller. a perfect example here is ecore_con and ecore_ipc 936 // the job of the caller. a perfect example here is ecore_con and ecore_ipc
939// where you create a con or ipc obj then set up type/destination/port and 937 // where you create a con or ipc obj then set up type/destination/port and
940// the finalize of the constructor does the actual connect and thus this 938 // the finalize of the constructor does the actual connect and thus this
941// fails or succeeds based on if service is there. 939 // fails or succeeds based on if service is there.
942// 940 //
943// until there is a better solution - don't complain here. 941 // until there is a better solution - don't complain here.
944// 942 //
945// ERR("Object of class '%s' - Finalizing the object failed.", 943 // ERR("Object of class '%s' - Finalizing the object failed.",
946// klass->desc->name); 944 // klass->desc->name);
947 goto cleanup; 945 goto cleanup;
948 }
949 } 946 }
950 947
951 fptr->o.obj->finalized = EINA_TRUE; 948 fptr->o.obj->finalized = EINA_TRUE;