Eo: Clean up windows code.
authorTom Hacohen <tom@stosb.com>
Mon, 28 Sep 2015 14:26:51 +0000 (15:26 +0100)
committerTom Hacohen <tom@stosb.com>
Mon, 28 Sep 2015 14:26:51 +0000 (15:26 +0100)
We were keeping a struct member that wasn't really needed on windows.
Since we already broke ABI, we can afford to clean this up.

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

index 0746bdf..e3c5f1c 100644 (file)
@@ -342,10 +342,7 @@ typedef enum _Eo_Class_Type Eo_Class_Type;
 
 typedef struct _Eo_Op_Description
 {
-   void *api_func;         /**< The EAPI function offering this op. */
-#ifdef _WIN32
-   const char *api_name;   /**< Full name of this API entry-point. Used to work around import indirection in DLL's. */
-#endif
+   void *api_func;         /**< The EAPI function offering this op. (The name of the func on windows) */
    void *func;             /**< The static function to call for the op. */
    Eo_Op op;               /**< The op. */
    Eo_Op_Type op_type;     /**< The type of the Op. */
@@ -463,10 +460,10 @@ EAPI extern Eo_Hook_Call eo_hook_call_post;
      if (Hook)                                                          \
        Hook(___call.klass, ___call.obj, FuncName, ___call.func, __VA_ARGS__);
 
-#ifdef _WIN32
-#define EO_FUNC_COMMON_OP_FUNC(Name) ((const void *) #Name)
+#ifndef _WIN32
+# define EO_FUNC_COMMON_OP_FUNC(Name) ((const void *) Name)
 #else
-#define EO_FUNC_COMMON_OP_FUNC(Name) ((const void *) Name)
+# define EO_FUNC_COMMON_OP_FUNC(Name) ((const void *) #Name)
 #endif
 
 // cache OP id, get real fct and object data then do the call
@@ -534,7 +531,7 @@ EAPI extern Eo_Hook_Call eo_hook_call_post;
 #ifndef _WIN32
 # define _EO_OP_API_ENTRY(a) a
 #else
-# define _EO_OP_API_ENTRY(a) a, #a
+# define _EO_OP_API_ENTRY(a) #a
 #endif
 
 #define EO_OP_FUNC(_api, _private) { _EO_OP_API_ENTRY(_api), _private, EO_NOOP, EO_OP_TYPE_REGULAR }
index d703208..da38fdc 100644 (file)
@@ -739,7 +739,6 @@ _eo_api_desc_get(const void *api_func, const _Eo_Class *klass, const _Eo_Class *
                     return op_desc;
                }
 #else
-             const char *api_name = api_func; /* We put it here on windows. */
              /* On Windows, DLL API's will be exported using the dllexport flag.
               * When used by another library or executable, they will be declared
               * using the dllimport flag. What happens really is that two symbols are
@@ -749,10 +748,9 @@ _eo_api_desc_get(const void *api_func, const _Eo_Class *klass, const _Eo_Class *
               */
              for (unsigned int i = 0; i < cur_klass->desc->ops.count; i++)
                {
-                  if (api_name && !strcmp(api_name, op_descs[i].api_name))
+                  if (((op_descs[i].api_func != NULL) && (op_descs[i].api_func != ((void (*)())-1))) &&
+                        (api_func && !strcmp(api_func, op_descs[i].api_func)))
                     {
-                       if (op_descs[i].api_func == NULL || op_descs[i].api_func == ((void (*)())-1))
-                          break;
                        return &op_descs[i];
                     }
                }
@@ -856,11 +854,7 @@ _eo_class_funcs_set(_Eo_Class *klass)
           }
         else if (op_desc->op == EO_OP_OVERRIDE)
           {
-#ifdef _WIN32
-             api_desc = _eo_api_desc_get(op_desc->api_name, klass->parent, klass->extensions);
-#else
              api_desc = _eo_api_desc_get(op_desc->api_func, klass->parent, klass->extensions);
-#endif
 
              if (api_desc == NULL)
                {