#define HOOK_H
#include <glib.h>
+#include <ltt/compiler.h>
/* A hook is a function to call with the supplied hook data, and with
call site specific data (e.g., hooks for events are called with a
/* Sometimes different hooks need to be called based on the case. The
case is represented by an unsigned integer id */
-typedef GPtrArray LttvHooksById;
+typedef struct _LttvHooksById {
+ GPtrArray *index;
+ GArray *array;
+} LttvHooksById;
+/* macro to calculate the hook ID of a facility/event pair. */
+#define GET_HOOK_ID(fac_id, ev_id) \
+ ( (guint)fac_id | ((guint)ev_id << FACILITIES_BITS) )
/* Create and destroy a hooks by id list */
static inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id)
{
LttvHooks *ret;
- if(likely(id < h->len)) ret = h->pdata[id];
+ if(likely(id < h->index->len)) ret = h->index->pdata[id];
else ret = NULL;
return ret;