tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=b9c5ef4eea486b2f1a31f5e778f71ec10501baf4

commit b9c5ef4eea486b2f1a31f5e778f71ec10501baf4
Author: Tom Hacohen <t...@stosb.com>
Date:   Mon Sep 5 16:25:34 2016 +0100

    Eo array callback: simplify code and fix reliance on gcc extensions.
    
    As far as I remember, declaring structures and arrays in a cast is a GCC
    extension. I'm not 100% sure I'm right, but I remember it was the case.
    
    Regardless of whether it's an extension or not, this commit removes that
    pattern and makes everything cleaner (and faster?).
---
 src/lib/eo/Eo.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 5531127..91e6608 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -1094,16 +1094,11 @@ EAPI int efl_callbacks_cmp(const 
Efl_Callback_Array_Item *a, const Efl_Callback_
   static Efl_Callback_Array_Item *                                      \
   Name(void)                                                            \
   {                                                                     \
-     static Efl_Callback_Array_Item internal[sizeof 
((Efl_Callback_Array_Item[]) { __VA_ARGS__ }) / \
-                                            sizeof (Efl_Callback_Array_Item) + 
\
-                                             1] = { { 0, 0 } };         \
+     static Efl_Callback_Array_Item internal[] = { __VA_ARGS__, \
+            { 0, 0 } };         \
      if (internal[0].desc == NULL)                                      \
        {                                                                \
-          memcpy(internal,                                              \
-                 ((Efl_Callback_Array_Item[]) { __VA_ARGS__, { NULL, NULL } 
}), \
-                 sizeof (Efl_Callback_Array_Item) +                     \
-                 sizeof ((Efl_Callback_Array_Item[]) { __VA_ARGS__ })); \
-          qsort(internal, sizeof (internal) / sizeof (internal[0]) - 1, sizeof 
(internal[0]), \
+          qsort(internal, EINA_C_ARRAY_LENGTH(internal) - 1, sizeof 
(internal[0]), \
                 (void*) efl_callbacks_cmp);                              \
        }                                                                \
      return internal;                                                   \

-- 


Reply via email to