eo: let's cache this value.

This commit is contained in:
Cedric Bail 2013-04-11 11:58:53 +09:00
parent 495088caf4
commit 2d9ec2159c
1 changed files with 6 additions and 4 deletions

View File

@ -20,6 +20,8 @@ static Eo_Class_Id _eo_classes_last_id;
static Eina_Bool _eo_init_count = 0; static Eina_Bool _eo_init_count = 0;
static Eo_Op _eo_ops_last_id = 0; static Eo_Op _eo_ops_last_id = 0;
static size_t _eo_sz = 0;
static void _eo_condtor_reset(Eo *obj); static void _eo_condtor_reset(Eo *obj);
static inline void *_eo_data_get(const Eo *obj, const Eo_Class *klass); static inline void *_eo_data_get(const Eo *obj, const Eo_Class *klass);
static inline Eo *_eo_ref(Eo *obj); static inline Eo *_eo_ref(Eo *obj);
@ -1369,15 +1371,13 @@ _eo_data_get(const Eo *obj, const Eo_Class *klass)
while (doff_itr->klass) while (doff_itr->klass)
{ {
if (doff_itr->klass == klass) if (doff_itr->klass == klass)
return ((char *) obj) + EO_ALIGN_SIZE(sizeof(*obj)) + return ((char *) obj) + _eo_sz + doff_itr->offset;
doff_itr->offset;
doff_itr++; doff_itr++;
} }
} }
else else
{ {
return ((char *) obj) + EO_ALIGN_SIZE(sizeof(*obj)) + return ((char *) obj) + _eo_sz + klass->data_offset;
klass->data_offset;
} }
} }
@ -1420,6 +1420,8 @@ eo_init(void)
eina_init(); eina_init();
_eo_sz = EO_ALIGN_SIZE(sizeof (Eo));
_eo_classes = NULL; _eo_classes = NULL;
_eo_classes_last_id = EO_CLASS_IDS_FIRST - 1; _eo_classes_last_id = EO_CLASS_IDS_FIRST - 1;
_eo_ops_last_id = EO_OP_IDS_FIRST; _eo_ops_last_id = EO_OP_IDS_FIRST;