eo2: revert "eo2_add accepts non-defauld constructors"
authorTom Hacohen <tom@stosb.com>
Tue, 30 Jul 2013 13:12:03 +0000 (14:12 +0100)
committerTom Hacohen <tom@stosb.com>
Thu, 10 Apr 2014 03:20:17 +0000 (04:20 +0100)
We want to have normal functions as non-default constructors, not va_arg
ones. What we should do is split the object creation to two parts again.
The creation, the constructing (changes using the macro) and the
verification/end part that checks the constructor has been called.

This reverts commit 2ff2ce1894f173b306a896bda595e1a7768c074d.

src/lib/eo/Eo.h
src/lib/eo/eo.c
src/lib/eo/eo_private.h

index 6e05e63..44e622e 100644 (file)
@@ -874,7 +874,7 @@ EAPI void eo_error_set_internal(const Eo *obj, const char *file, int line);
 #define eo2_add(klass, parent, ...) \
    ({ \
     const Eo_Class *_tmp_klass = klass; \
-    eo_add_internal(__FILE__, __LINE__, _tmp_klass, parent, eo2_constructor, ## __VA_ARGS__, EO_NOOP); \
+    eo_add_internal(__FILE__, __LINE__, _tmp_klass, parent, ## __VA_ARGS__, EO_NOOP); \
     })
 
 /**
index 33485a5..1a48d24 100644 (file)
@@ -1472,22 +1472,8 @@ eo_add_internal(const char *file, int line, const Eo_Class *klass_id, Eo *parent
 
    /* Run the relevant do stuff. */
    if (klass->desc->version == EO2_VERSION)
-     {
-        eo2_constructor_type constr;
-        va_list p_list;
-        if(eo2_do_start((Eo *)obj_id, EINA_FALSE))
-          {
-             va_start(p_list, parent_id);
-             while ((constr = va_arg(p_list, eo2_constructor_type)))
-               constr();
-             va_end(p_list);
-             eo2_do_end(NULL);
-             do_err = EINA_FALSE;
-          }
-        else
-          do_err = EINA_TRUE;
-     }
-   else
+     eo2_do((Eo *)obj_id, eo2_constructor());
+   /* Run the relevant do stuff. */
      {
         va_list p_list;
         va_start(p_list, parent_id);
index bd37953..614483f 100644 (file)
@@ -61,7 +61,6 @@ typedef struct _Eo_Class _Eo_Class;
 typedef struct _Eo_Object _Eo_Object;
 typedef struct _Eo_Base Eo_Base;
 typedef struct _Eo_Internal _Eo;
-typedef void (*eo2_constructor_type)(void);
 
 /* Retrieves the pointer to the object from the id */
 static inline _Eo_Object *_eo_obj_pointer_get(const Eo_Id obj_id);