Eo * _eo_class_id_get(const _Eo_Class *klass)
{
#ifdef HAVE_EO_ID
- return (Eo *) klass->class_id;
+ return (Eo *) klass->header.id;
#else
return (Eo *) HANDLE_FROM_EO(klass);
#endif
if (op_type == EO_OP_TYPE_REGULAR)
{
func_data = _eo_data_scope_get(eo_ptr.obj, func->src);
- calling_obj = (Eo *)eo_ptr.obj->obj_id;
+ calling_obj = (Eo *)eo_ptr.obj->header.id;
}
else
{
_Eo_Class *parent = _eo_class_pointer_get(parent_id);
#ifndef HAVE_EO_ID
- if (parent && !EINA_MAGIC_CHECK(parent, EO_CLASS_EINA_MAGIC))
+ if (parent && !EINA_MAGIC_CHECK((Eo_Header *) parent, EO_CLASS_EINA_MAGIC))
{
- EINA_MAGIC_FAIL(parent, EO_CLASS_EINA_MAGIC);
+ EINA_MAGIC_FAIL((Eo_Header *) parent, EO_CLASS_EINA_MAGIC);
return NULL;
}
#endif
hndl = calloc(1, _eo_handle_sz + _eo_class_sz + extn_sz + mro_sz + mixins_sz);
hndl->is_a_class = 1;
klass = (_Eo_Class *) EO_FROM_HANDLE(hndl);
- EINA_MAGIC_SET(klass, EO_CLASS_EINA_MAGIC);
+ EINA_MAGIC_SET((Eo_Header *) klass, EO_CLASS_EINA_MAGIC);
#endif
eina_lock_new(&klass->objects.trash_lock);
eina_lock_new(&klass->iterators.trash_lock);
}
eina_lock_take(&_eo_class_creation_lock);
- klass->class_id = ++_eo_classes_last_id;
+ klass->header.id = ++_eo_classes_last_id;
{
/* FIXME: Handle errors. */
size_t arrsize = _eo_classes_last_id * sizeof(*_eo_classes);
memset(tmp, 0, arrsize);
_eo_classes = tmp;
- _eo_classes[klass->class_id - 1] = klass;
+ _eo_classes[klass->header.id - 1] = klass;
}
eina_lock_release(&_eo_class_creation_lock);
obj->klass = klass;
#ifndef HAVE_EO_ID
- EINA_MAGIC_SET(obj, EO_EINA_MAGIC);
+ EINA_MAGIC_SET((Eo_Header *) obj, EO_EINA_MAGIC);
#endif
Eo_Id obj_id = _eo_id_allocate(obj);
- obj->obj_id = obj_id;
+ obj->header.id = obj_id;
_eo_condtor_reset(obj);
(obj->datarefcount)++;
#ifdef EO_DEBUG
Eo_Xref_Node *xref = calloc(1, sizeof(*xref));
- xref->ref_obj = (Eo *)ref_obj->obj_id;
+ xref->ref_obj = (Eo *)ref_obj->header.id;
xref->file = file;
xref->line = line;
((char *)data < (((char *) obj) + klass->obj_size)));
if (!in_range)
{
- ERR("Data %p is not in the data range of the object %p (%s).", data, (Eo *)obj->obj_id, obj->klass->desc->name);
+ ERR("Data %p is not in the data range of the object %p (%s).", data, (Eo *)obj->headr.id, obj->klass->desc->name);
}
#else
(void) data;
#endif
if (obj->datarefcount == 0)
{
- ERR("Data for object %lx (%s) is already not referenced.", (unsigned long)obj->obj_id, obj->klass->desc->name);
+ ERR("Data for object %lx (%s) is already not referenced.", (unsigned long)obj->header.id, obj->klass->desc->name);
}
else
{
Eo_Xref_Node *xref = NULL;
EINA_INLIST_FOREACH(obj->data_xrefs, xref)
{
- if (xref->ref_obj == (Eo *)ref_obj->obj_id)
+ if (xref->ref_obj == (Eo *)ref_obj->header.id)
break;
}
}
else
{
- ERR("ref_obj (0x%lx) does not reference data (%p) of obj (0x%lx).", (unsigned long)ref_obj->obj_id, data, (unsigned long)obj->obj_id);
+ ERR("ref_obj (0x%lx) does not reference data (%p) of obj (0x%lx).", (unsigned long)ref_obj->header.id, data, (unsigned long)obj->header.id);
}
#else
(void) ref_obj;
typedef uintptr_t Eo_Id;
typedef struct _Eo_Class _Eo_Class;
typedef struct _Eo_Object _Eo_Object;
+typedef struct _Eo_Header Eo_Header;
typedef struct _Eo_Handle _Eo_Handle;
typedef union _Eo {
_Eo_Object *obj;
Eina_Bool is_a_class:1;
};
-struct _Eo_Object {
+struct _Eo_Header
+{
#ifndef HAVE_EO_ID
EINA_MAGIC
#endif
- Eo_Id obj_id;
+ Eo_Id id;
+};
+struct _Eo_Object
+{
+ Eo_Header header;
Eo *parent;
Eina_List *children;
const _Eo_Class *klass;
struct _Eo_Class
{
-#ifndef HAVE_EO_ID
- EINA_MAGIC
-#endif
- Eo_Id class_id;
+ Eo_Header header;
const _Eo_Class *parent;
const Eo_Class_Description *desc;
/* We need that for the event callbacks that may ref/unref. */
obj->refcount++;
- eo_do((Eo *) obj->obj_id, eo_event_callback_call(EO_EV_DEL, NULL, NULL));
+ eo_do((Eo *) obj->header.id, eo_event_callback_call(EO_EV_DEL, NULL, NULL));
const _Eo_Class *klass = obj->klass;
_eo_condtor_reset(obj);
- do_err = eo_do((Eo *)obj->obj_id, eo_destructor());
+ do_err = eo_do((Eo *)obj->header.id, eo_destructor());
if (EINA_UNLIKELY(!do_err))
{
ERR("in %s:%d: Object of class '%s' - One of the object destructors have failed.",
Eo *emb_obj;
EINA_LIST_FOREACH_SAFE(obj->composite_objects, itr, itr_n, emb_obj)
{
- eo_composite_detach(emb_obj, (Eo *)obj->obj_id);
+ eo_composite_detach(emb_obj, (Eo *)obj->header.id);
}
}
ERR("Object %p data still referenced %d time(s).", obj, obj->datarefcount);
}
#endif
- _eo_id_release(obj->obj_id);
+ _eo_id_release(obj->header.id);
eina_lock_take(&klass->objects.trash_lock);
if (klass->objects.trash_count <= 8)
{
Eina_Inlist *nitr = obj->data_xrefs->next;
Eo_Xref_Node *xref = EINA_INLIST_CONTAINER_GET(obj->data_xrefs, Eo_Xref_Node);
- ERR("Data of object 0x%lx is still referenced by object %p", (unsigned long)obj->obj_id, xref->ref_obj);
+ ERR("Data of object 0x%lx is still referenced by object %p", (unsigned long)obj->header.id, xref->ref_obj);
free(xref);
obj->data_xrefs = nitr;
_Eo_Object *obj; \
do { \
obj = _eo_obj_pointer_get((Eo_Id)obj_id); \
- EO_MAGIC_RETURN_VAL(obj, EO_EINA_MAGIC, ret); \
+ EO_MAGIC_RETURN_VAL((Eo_Header *) obj, EO_EINA_MAGIC, ret); \
} while (0)
#define EO_OBJ_POINTER_RETURN(obj_id, obj) \
_Eo_Object *obj; \
do { \
obj = _eo_obj_pointer_get((Eo_Id)obj_id); \
- EO_MAGIC_RETURN(obj, EO_EINA_MAGIC); \
+ EO_MAGIC_RETURN((Eo_Header *) obj, EO_EINA_MAGIC); \
} while (0)
#define EO_CLASS_POINTER_RETURN_VAL(klass_id, klass, ret) \
_Eo_Class *klass; \
do { \
klass = _eo_class_pointer_get(klass_id); \
- EO_MAGIC_RETURN_VAL(klass, EO_CLASS_EINA_MAGIC, ret); \
+ EO_MAGIC_RETURN_VAL((Eo_Header *) klass, EO_CLASS_EINA_MAGIC, ret); \
} while (0)
#define EO_CLASS_POINTER_RETURN(klass_id, klass) \
_Eo_Class *klass; \
do { \
klass = _eo_class_pointer_get(klass_id); \
- EO_MAGIC_RETURN(klass, EO_CLASS_EINA_MAGIC); \
+ EO_MAGIC_RETURN((Eo_Header *) klass, EO_CLASS_EINA_MAGIC); \
} while (0)
#endif