On 05/09/16 17:40, Cedric BAIL wrote: > On Sep 5, 2016 07:29, "Tom Hacohen" <t...@stosb.com> wrote: >> >> 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. > > I have no idea what you're talking about, but pretty sure you borked very > well ! > >> 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) \ > > When is that test going to be taken ? Also setting data to a static > variable with pointer is not supported on Windows, which is why this > function exist in the first place.
Test: you are correct. :( Windows: Oh god, not even in a function? OK, will fix it properly. Sorry. > >> { \ >> - 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; \ >> >> -- >> >> > ------------------------------------------------------------------------------ > _______________________________________________ > enlightenment-devel mailing list > enlightenment-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel > ------------------------------------------------------------------------------ _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel