likely/unlikely branch prediction
[lttv.git] / ltt / branches / poly / lttv / lttv / hook.h
index 5d7c26224ceef3b1cb191371cd0cc89cc0de6560..7da21346f2c2cd3f82b55e3e658bed53b0ed49f6 100644 (file)
@@ -92,6 +92,7 @@ void lttv_hooks_get(LttvHooks *h, unsigned i, LttvHook *f, void **hook_data,
 
 
 /* Remove the specified hook. The position of the following hooks may change */
+/* The hook is removed from the list event if its ref_count is higher than 1 */
 
 void lttv_hooks_remove_by_position(LttvHooks *h, unsigned i);
 
@@ -143,7 +144,14 @@ unsigned lttv_hooks_by_id_max_id(LttvHooksById *h);
 
 /* Get the list of hooks for an id, NULL if none exists */
 
-LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id);
+static inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id)
+{
+  LttvHooks *ret;
+  if(likely(id < h->len)) ret = h->pdata[id];
+  else ret = NULL;
+
+  return ret;
+}
 
 
 /* Remove the list of hooks associated with an id */
This page took 0.023603 seconds and 4 git commands to generate.