cedric pushed a commit to branch master.

commit e939d9a1cecb0d7099399ff350d330442e7fb632
Author: Cedric Bail <[email protected]>
Date:   Tue Jul 16 20:03:02 2013 +0900

    eo: let's add a macro to define a callbacks array.
---
 src/lib/eo/Eo.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 09d9339..bb70fdb 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -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.

-- 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

Reply via email to