eo: let's add a macro to define a callbacks array.

This commit is contained in:
Cedric Bail 2013-07-16 20:03:02 +09:00
parent cecd19803e
commit e939d9a1ce
1 changed files with 14 additions and 0 deletions

View File

@ -1307,6 +1307,20 @@ struct _Eo_Callback_Array_Item
Eo_Event_Cb func; /**< The callback function. */
};
#define EO_CALLBACKS_ARRAY_DEFINE(Name, Count, ...) \
static Eo_Callback_Array_Item * \
Name(void) \
{ \
static Eo_Callback_Array_Item internal[Count] = { { 0 } }; \
if (internal[0].desc == NULL) \
{ \
memcpy(internal, \
((Eo_Callback_Array_Item[Count]) { __VA_ARGS__ }), \
sizeof(Eo_Callback_Array_Item) * Count); \
} \
return internal; \
}
/**
* @def eo_event_callback_forwarder_add
* @brief Add an event callback forwarder for an event and an object.