summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-18 14:37:10 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-18 14:38:43 +0100
commitb1edfa61491e5d82809e2fc376954b7de938bbb2 (patch)
treec83497a8f6293856f3bc6232972e4b6389c6960a
parentacdacefeb3661675b9927c04aa2016ba7f409f63 (diff)
-rw-r--r--src/lib/eo/eo.c35
-rw-r--r--src/lib/eo/eo_private.h1
2 files changed, 6 insertions, 30 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c
index f7ce233d1e..94cc5e91e0 100644
--- a/src/lib/eo/eo.c
+++ b/src/lib/eo/eo.c
@@ -90,7 +90,6 @@ static _Efl_Class **_eo_classes = NULL;
90static Eo_Id _eo_classes_last_id = 0; 90static Eo_Id _eo_classes_last_id = 0;
91static Eo_Id _eo_classes_alloc = 0; 91static Eo_Id _eo_classes_alloc = 0;
92static int _efl_object_init_count = 0; 92static int _efl_object_init_count = 0;
93static Efl_Object_Op _eo_ops_last_id = 0;
94static Eina_Hash *_ops_storage2 = NULL; 93static Eina_Hash *_ops_storage2 = NULL;
95static Eina_Spinlock _ops_storage_lock; 94static Eina_Spinlock _ops_storage_lock;
96 95
@@ -119,36 +118,17 @@ static inline Efl_Object_Op _efl_object_api_op_id_get_internal2(const void *api_
119 (_eo_classes[_UNMASK_ID(id) - 1]) : NULL); \ 118 (_eo_classes[_UNMASK_ID(id) - 1]) : NULL); \
120 }) 119 })
121 120
122/* XXX: Only used for a debug message below. Doesn't matter that it's slow. */ 121#define EFL_OBJECT_OP_CLASS_PART(op) op >> 16
122#define EFL_OBJECT_OP_FUNC_PART(op) op & 0xffff
123#define EFL_OBJECT_OP_CREATE_OP_ID(class_id, func_id) ((unsigned short)class_id)<<16|((unsigned short)func_id&0xffff)
124
123static const _Efl_Class * 125static const _Efl_Class *
124_eo_op_class_get(Efl_Object_Op op) 126_eo_op_class_get(Efl_Object_Op op)
125{ 127{
126 _Efl_Class **itr = _eo_classes; 128 short class_id = EFL_OBJECT_OP_CLASS_PART(op);
127 int mid, max, min; 129 return _eo_classes[class_id];
128
129 min = 0;
130 max = _eo_classes_last_id - 1;
131 while (min <= max)
132 {
133 mid = (min + max) / 2;
134
135 if (itr[mid]->base_id + itr[mid]->ops_count < op)
136 min = mid + 1;
137 else if (itr[mid]->base_id > op)
138 max = mid - 1;
139 else
140 return itr[mid];
141 }
142
143 return NULL;
144} 130}
145 131
146//
147
148#define EFL_OBJECT_OP_CLASS_PART(op) op >> 16
149#define EFL_OBJECT_OP_FUNC_PART(op) op & 0xffff
150#define EFL_OBJECT_OP_CREATE_OP_ID(class_id, func_id) ((unsigned short)class_id)<<16|((unsigned short)func_id&0xffff)
151
152/** 132/**
153 * This inits the vtable wit hthe current size of allocated tables 133 * This inits the vtable wit hthe current size of allocated tables
154 */ 134 */
@@ -880,11 +860,9 @@ efl_class_functions_set(const Efl_Class *klass_id, const Efl_Object_Ops *object_
880 860
881 klass->ops_count = object_ops->count; 861 klass->ops_count = object_ops->count;
882 862
883 klass->base_id = _eo_ops_last_id;
884 klass->base_id2 = _UNMASK_ID(klass->header.id) - 1; 863 klass->base_id2 = _UNMASK_ID(klass->header.id) - 1;
885 hitmap = alloca(sizeof(Eina_Bool) * klass->base_id2); 864 hitmap = alloca(sizeof(Eina_Bool) * klass->base_id2);
886 memset(hitmap, 0, sizeof(Eina_Bool) * klass->base_id2); 865 memset(hitmap, 0, sizeof(Eina_Bool) * klass->base_id2);
887 _eo_ops_last_id += klass->ops_count + 1;
888 866
889 _vtable_init(&klass->vtable2); 867 _vtable_init(&klass->vtable2);
890 868
@@ -2373,7 +2351,6 @@ efl_object_init(void)
2373 2351
2374 _eo_classes = NULL; 2352 _eo_classes = NULL;
2375 _eo_classes_last_id = EO_CLASS_IDS_FIRST - 1; 2353 _eo_classes_last_id = EO_CLASS_IDS_FIRST - 1;
2376 _eo_ops_last_id = EFL_OBJECT_OP_IDS_FIRST;
2377 _eo_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_LIGHTBLUE); 2354 _eo_log_dom = eina_log_domain_register(log_dom, EINA_COLOR_LIGHTBLUE);
2378 if (_eo_log_dom < 0) 2355 if (_eo_log_dom < 0)
2379 { 2356 {
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 8b456e612a..a032c229f3 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -189,7 +189,6 @@ struct _Efl_Class
189 } iterators; 189 } iterators;
190 190
191 unsigned int obj_size; /**< size of an object of this class */ 191 unsigned int obj_size; /**< size of an object of this class */
192 unsigned int base_id;
193 unsigned int base_id2; 192 unsigned int base_id2;
194 unsigned int data_offset; /* < Offset of the data within object data. */ 193 unsigned int data_offset; /* < Offset of the data within object data. */
195 unsigned int ops_count; /* < Offset of the data within object data. */ 194 unsigned int ops_count; /* < Offset of the data within object data. */