summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-05-12 19:50:17 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-05-17 15:04:01 +0900
commit1d0b37a9e6a497811b2a6c2cb45ff56c2fceeb78 (patch)
treecd50a9ebc3d195d6e35260ebf91e6daacc2267f3 /src/lib/eo
parentf603001367d3c45a24a19cf098c7d8c70f92b93d (diff)
eo - eoid - finally rtemove option to not have eoid. it doesn't work
we use too many bits for metadata now so eoid is broken... remove it as an option so people dont break out the foot guns
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/eo.c39
-rw-r--r--src/lib/eo/eo_private.h7
-rw-r--r--src/lib/eo/eo_ptr_indirection.c21
-rw-r--r--src/lib/eo/eo_ptr_indirection.h4
-rw-r--r--src/lib/eo/eo_ptr_indirection.x13
5 files changed, 6 insertions, 78 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index a533f7af23..a2db10382d 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -272,11 +272,7 @@ _vtable_func_clean_all(Eo_Vtable *vtable)
272 272
273/* END OF DICH */ 273/* END OF DICH */
274 274
275#ifdef HAVE_EO_ID 275#define _EO_ID_GET(Id) ((Eo_Id) (Id))
276# define _EO_ID_GET(Id) ((Eo_Id) (Id))
277#else
278# define _EO_ID_GET(Id) ((Eo_Id) ((Id) ? ((Eo_Header *) (Id))->id : 0))
279#endif
280 276
281 277
282static inline Eina_Bool 278static inline Eina_Bool
@@ -294,30 +290,9 @@ _eo_is_a_class(const Eo *eo_id)
294} 290}
295 291
296static inline _Efl_Class * 292static inline _Efl_Class *
297_eo_class_pointer_get(const Efl_Class *klass_id, const char *func_name, const char *file, int line) 293_eo_class_pointer_get(const Efl_Class *klass_id)
298{ 294{
299#ifdef HAVE_EO_ID
300 return ID_CLASS_GET((Eo_Id)klass_id); 295 return ID_CLASS_GET((Eo_Id)klass_id);
301 (void)func_name;
302 (void)file;
303 (void)line;
304#else
305 Eo_Header *klass = (Eo_Header *)klass_id;
306 if (EINA_UNLIKELY(!klass))
307 {
308 eina_log_print(_eo_log_dom,
309 EINA_LOG_LEVEL_DBG,
310 file, func_name, line,
311 "klass_id is NULL. Possibly unintended access?");
312 return NULL;
313 }
314 if (EINA_UNLIKELY(!EINA_MAGIC_CHECK(klass, EO_CLASS_EINA_MAGIC)))
315 {
316 eina_magic_fail(klass, klass->__magic, EO_CLASS_EINA_MAGIC, file, func_name, line);
317 return NULL;
318 }
319 return (_Efl_Class *) klass_id;
320#endif
321} 296}
322 297
323static const char * 298static const char *
@@ -874,9 +849,6 @@ _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, E
874 obj->refcount++; 849 obj->refcount++;
875 obj->klass = klass; 850 obj->klass = klass;
876 851
877#ifndef HAVE_EO_ID
878 EINA_MAGIC_SET((Eo_Header *) obj, EO_EINA_MAGIC);
879#endif
880 obj->header.id = _eo_id_allocate(obj, parent_id); 852 obj->header.id = _eo_id_allocate(obj, parent_id);
881 Eo *eo_id = _eo_obj_id_get(obj); 853 Eo *eo_id = _eo_obj_id_get(obj);
882 854
@@ -1379,7 +1351,7 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ...
1379 1351
1380 if (parent_id) 1352 if (parent_id)
1381 { 1353 {
1382 parent = _eo_class_pointer_get(parent_id, __FUNCTION__, __FILE__, __LINE__); 1354 parent = _eo_class_pointer_get(parent_id);
1383 if (!parent) 1355 if (!parent)
1384 return NULL; 1356 return NULL;
1385 } 1357 }
@@ -1431,7 +1403,7 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ...
1431 extn_id = va_arg(p_list, Eo_Id *); 1403 extn_id = va_arg(p_list, Eo_Id *);
1432 while (extn_id) 1404 while (extn_id)
1433 { 1405 {
1434 extn = _eo_class_pointer_get((Efl_Class *)extn_id, __FUNCTION__, __FILE__, __LINE__); 1406 extn = _eo_class_pointer_get((Efl_Class *)extn_id);
1435 if (EINA_LIKELY(extn != NULL)) 1407 if (EINA_LIKELY(extn != NULL))
1436 { 1408 {
1437 switch (extn->desc->type) 1409 switch (extn->desc->type)
@@ -1495,9 +1467,6 @@ efl_class_new(const Efl_Class_Description *desc, const Efl_Class *parent_id, ...
1495 } 1467 }
1496 1468
1497 klass = calloc(1, _eo_class_sz + extn_sz + mro_sz + mixins_sz); 1469 klass = calloc(1, _eo_class_sz + extn_sz + mro_sz + mixins_sz);
1498#ifndef HAVE_EO_ID
1499 EINA_MAGIC_SET((Eo_Header *) klass, EO_CLASS_EINA_MAGIC);
1500#endif
1501 eina_spinlock_new(&klass->objects.trash_lock); 1470 eina_spinlock_new(&klass->objects.trash_lock);
1502 eina_spinlock_new(&klass->iterators.trash_lock); 1471 eina_spinlock_new(&klass->iterators.trash_lock);
1503 klass->parent = parent; 1472 klass->parent = parent;
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 96cd593854..93fcba97dd 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -83,9 +83,6 @@ void _vtable_func_clean_all(Eo_Vtable *vtable);
83 83
84struct _Eo_Header 84struct _Eo_Header
85{ 85{
86#ifndef HAVE_EO_ID
87 EINA_MAGIC
88#endif
89 Eo_Id id; 86 Eo_Id id;
90}; 87};
91 88
@@ -224,11 +221,7 @@ void _efl_object_parent_sink_set(Eo *obj, Eina_Bool sink);
224static inline 221static inline
225Eo *_eo_header_id_get(const Eo_Header *header) 222Eo *_eo_header_id_get(const Eo_Header *header)
226{ 223{
227#ifdef HAVE_EO_ID
228 return (Eo *) header->id; 224 return (Eo *) header->id;
229#else
230 return (Eo *) header;
231#endif
232} 225}
233 226
234/* Retrieves the pointer to the object from the id */ 227/* Retrieves the pointer to the object from the id */
diff --git a/src/lib/eo/eo_ptr_indirection.c b/src/lib/eo/eo_ptr_indirection.c
index 2ef278a438..0dcb0b942f 100644
--- a/src/lib/eo/eo_ptr_indirection.c
+++ b/src/lib/eo/eo_ptr_indirection.c
@@ -25,7 +25,6 @@ _eo_pointer_error(const Eo *obj_id, const char *func_name, const char *file, int
25 _eo_log_obj_report((Eo_Id)obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line); 25 _eo_log_obj_report((Eo_Id)obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line);
26} 26}
27 27
28#ifdef HAVE_EO_ID
29static void 28static void
30_eo_obj_pointer_invalid(const Eo_Id obj_id, 29_eo_obj_pointer_invalid(const Eo_Id obj_id,
31 Eo_Id_Data *data, 30 Eo_Id_Data *data,
@@ -68,12 +67,10 @@ _eo_obj_pointer_invalid(const Eo_Id obj_id,
68 ); 67 );
69 _eo_log_obj_report(obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line); 68 _eo_log_obj_report(obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line);
70} 69}
71#endif
72 70
73_Eo_Object * 71_Eo_Object *
74_eo_obj_pointer_get(const Eo_Id obj_id, const char *func_name, const char *file, int line) 72_eo_obj_pointer_get(const Eo_Id obj_id, const char *func_name, const char *file, int line)
75{ 73{
76#ifdef HAVE_EO_ID
77 _Eo_Id_Entry *entry; 74 _Eo_Id_Entry *entry;
78 Generation_Counter generation; 75 Generation_Counter generation;
79 Table_Index mid_table_id, table_id, entry_id; 76 Table_Index mid_table_id, table_id, entry_id;
@@ -183,22 +180,4 @@ err_shared:
183err: 180err:
184 _eo_obj_pointer_invalid(obj_id, data, domain, func_name, file, line); 181 _eo_obj_pointer_invalid(obj_id, data, domain, func_name, file, line);
185 return NULL; 182 return NULL;
186#else
187 Eo_Header *obj = (Eo_Header *)obj_id;
188 if (EINA_UNLIKELY(!obj))
189 {
190 eina_log_print(_eo_log_dom,
191 EINA_LOG_LEVEL_DBG,
192 file, func_name, line,
193 "obj_id is NULL. Possibly unintended access?");
194 return NULL;
195 }
196 if (EINA_UNLIKELY(!EINA_MAGIC_CHECK(obj, EO_EINA_MAGIC)))
197 {
198 eina_magic_fail(obj, obj->__magic, EO_EINA_MAGIC, file, func_name, line);
199 _eo_log_obj_report(obj_id, EINA_LOG_LEVEL_ERR, func_name, file, line);
200 return NULL;
201 }
202 return (_Eo_Object *) obj_id;
203#endif
204} 183}
diff --git a/src/lib/eo/eo_ptr_indirection.h b/src/lib/eo/eo_ptr_indirection.h
index afe5a4a5ce..c0aaff8089 100644
--- a/src/lib/eo/eo_ptr_indirection.h
+++ b/src/lib/eo/eo_ptr_indirection.h
@@ -121,14 +121,14 @@ void _eo_pointer_error(const Eo *obj_id, const char *func_name, const char *file
121#define EO_CLASS_POINTER_GOTO(klass_id, klass, label) \ 121#define EO_CLASS_POINTER_GOTO(klass_id, klass, label) \
122 _Efl_Class *klass; \ 122 _Efl_Class *klass; \
123 do { \ 123 do { \
124 klass = _eo_class_pointer_get(klass_id, __FUNCTION__, __FILE__, __LINE__); \ 124 klass = _eo_class_pointer_get(klass_id); \
125 if (!klass) goto label; \ 125 if (!klass) goto label; \
126 } while (0) 126 } while (0)
127 127
128#define EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, label) \ 128#define EO_CLASS_POINTER_GOTO_PROXY(klass_id, klass, label) \
129 _Efl_Class *klass; \ 129 _Efl_Class *klass; \
130 do { \ 130 do { \
131 klass = _eo_class_pointer_get(klass_id, func_name, file, line); \ 131 klass = _eo_class_pointer_get(klass_id); \
132 if (!klass) goto label; \ 132 if (!klass) goto label; \
133 } while (0) 133 } while (0)
134 134
diff --git a/src/lib/eo/eo_ptr_indirection.x b/src/lib/eo/eo_ptr_indirection.x
index fcaa7874a8..d9bd863cc7 100644
--- a/src/lib/eo/eo_ptr_indirection.x
+++ b/src/lib/eo/eo_ptr_indirection.x
@@ -358,12 +358,9 @@ _eo_id_domain_compatible(const Eo *o1, const Eo *o2)
358static inline void 358static inline void
359_eo_obj_pointer_done(const Eo_Id obj_id) 359_eo_obj_pointer_done(const Eo_Id obj_id)
360{ 360{
361#ifdef HAVE_EO_ID
362 Efl_Id_Domain domain = (obj_id >> SHIFT_DOMAIN) & MASK_DOMAIN; 361 Efl_Id_Domain domain = (obj_id >> SHIFT_DOMAIN) & MASK_DOMAIN;
363 if (EINA_LIKELY(domain != EFL_ID_DOMAIN_SHARED)) return; 362 if (EINA_LIKELY(domain != EFL_ID_DOMAIN_SHARED)) return;
364 eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); 363 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
365#endif
366 (void)obj_id;
367} 364}
368 365
369////////////////////////////////////////////////////////////////////////// 366//////////////////////////////////////////////////////////////////////////
@@ -483,7 +480,6 @@ _search_tables(Eo_Id_Table_Data *tdata)
483static inline Eo_Id 480static inline Eo_Id
484_eo_id_allocate(const _Eo_Object *obj, const Eo *parent_id) 481_eo_id_allocate(const _Eo_Object *obj, const Eo *parent_id)
485{ 482{
486#ifdef HAVE_EO_ID
487 _Eo_Id_Entry *entry = NULL; 483 _Eo_Id_Entry *entry = NULL;
488 Eo_Id_Data *data; 484 Eo_Id_Data *data;
489 Eo_Id_Table_Data *tdata; 485 Eo_Id_Table_Data *tdata;
@@ -555,17 +551,11 @@ shared_err:
555 eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); 551 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
556 } 552 }
557 return id; 553 return id;
558#else
559 (void) obj;
560 (void) parent_id;
561 return MASK_OBJ_TAG;
562#endif
563} 554}
564 555
565static inline void 556static inline void
566_eo_id_release(const Eo_Id obj_id) 557_eo_id_release(const Eo_Id obj_id)
567{ 558{
568#ifdef HAVE_EO_ID
569 _Eo_Ids_Table *table; 559 _Eo_Ids_Table *table;
570 _Eo_Id_Entry *entry; 560 _Eo_Id_Entry *entry;
571 Generation_Counter generation; 561 Generation_Counter generation;
@@ -683,9 +673,6 @@ _eo_id_release(const Eo_Id obj_id)
683 eina_lock_release(&(_eo_table_data_shared_data->obj_lock)); 673 eina_lock_release(&(_eo_table_data_shared_data->obj_lock));
684 } 674 }
685 ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.", (void *)obj_id); 675 ERR("obj_id %p is not pointing to a valid object. Maybe it has already been freed.", (void *)obj_id);
686#else
687 EINA_MAGIC_SET((Eo_Header *) obj_id, EO_FREED_EINA_MAGIC);
688#endif
689} 676}
690 677
691static inline void 678static inline void