X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Flttv%2Fhook.h;h=325d218671c7a98f080a5a3df12d8b56ff2cc846;hb=d34141ca6fc6dd872a922134b22095bd74ec013d;hp=77a5dd5f59194ede727e5760c55d9f62f741ab88;hpb=04cd9a1e94f33a731da0871ab6c4edb3db37cc4d;p=lttv.git diff --git a/ltt/branches/poly/lttv/lttv/hook.h b/ltt/branches/poly/lttv/lttv/hook.h index 77a5dd5f..325d2186 100644 --- a/ltt/branches/poly/lttv/lttv/hook.h +++ b/ltt/branches/poly/lttv/lttv/hook.h @@ -22,6 +22,7 @@ #define HOOK_H #include +#include /* 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 @@ -122,8 +123,10 @@ gboolean lttv_hooks_call_check_merge(LttvHooks *h1, void *call_data1, /* 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; /* Create and destroy a hooks by id list */ @@ -147,7 +150,7 @@ unsigned lttv_hooks_by_id_max_id(LttvHooksById *h); static inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id) { LttvHooks *ret; - if(id < h->len) ret = h->pdata[id]; + if(likely(id < h->index->len)) ret = h->index->pdata[id]; else ret = NULL; return ret;