X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=lttv%2Flttv%2Fhook.h;h=13473ca549f3e69ecbc8e89703adb1fb8bc63d5b;hb=b9ce0bad7daf7c0a2333c91fdb1e35d602afe17f;hp=91f0c13f9a02d6b0d35d304781dbf87dba9685f8;hpb=f61f4dca50e13aa52b1ca3941c8f420848f4353f;p=lttv.git diff --git a/lttv/lttv/hook.h b/lttv/lttv/hook.h index 91f0c13f..13473ca5 100644 --- a/lttv/lttv/hook.h +++ b/lttv/lttv/hook.h @@ -14,15 +14,15 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, - * MA 02111-1307, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. */ #ifndef HOOK_H #define HOOK_H #include -#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 @@ -77,7 +77,7 @@ void lttv_hooks_remove_data(LttvHooks *h, LttvHook f, void *hook_data); /* Remove a list of hooks from the hooks list in h. */ -void lttv_hooks_remove_list(LttvHooks *h, LttvHooks *list); +void lttv_hooks_remove_list(LttvHooks *h, const LttvHooks *list); /* Return the number of hooks in the list */ @@ -89,7 +89,7 @@ unsigned lttv_hooks_number(LttvHooks *h); * *f and *hook_data are NULL if no hook exists at that position. */ void lttv_hooks_get(LttvHooks *h, unsigned i, LttvHook *f, void **hook_data, - LttvHookPrio *p); + LttvHookPrio *p); /* Remove the specified hook. The position of the following hooks may change */ @@ -115,17 +115,19 @@ gboolean lttv_hooks_call_check(LttvHooks *h, void *call_data); * hooks from h1 are called first. */ gboolean lttv_hooks_call_merge(LttvHooks *h1, void *call_data1, - LttvHooks *h2, void *call_data2); + LttvHooks *h2, void *call_data2); gboolean lttv_hooks_call_check_merge(LttvHooks *h1, void *call_data1, - LttvHooks *h2, void *call_data2); + LttvHooks *h2, void *call_data2); + +#ifdef BABEL_CLEANUP /* Sometimes different hooks need to be called based on the case. The case is represented by an unsigned integer id */ typedef struct _LttvHooksById { - GPtrArray *index; - GArray *array; + GPtrArray *index; + GArray *array; } LttvHooksById; /* Create and destroy a hooks by id list */ @@ -149,11 +151,11 @@ unsigned lttv_hooks_by_id_max_id(LttvHooksById *h); static inline LttvHooks *lttv_hooks_by_id_get(LttvHooksById *h, unsigned id) { - LttvHooks *ret; - if(likely(id < h->index->len)) ret = h->index->pdata[id]; - else ret = NULL; + LttvHooks *ret; + if(likely(id < h->index->len)) ret = h->index->pdata[id]; + else ret = NULL; - return ret; + return ret; } /* Remove the list of hooks associated with an id */ @@ -169,12 +171,12 @@ void lttv_hooks_by_id_copy(LttvHooksById *dest, LttvHooksById *src); /* Internal structure, contained in by the LttvHooksByIdChannelArray */ typedef struct _LttvHooksByIdChannel { - LttvHooksById *hooks_by_id; - GQuark channel; + LttvHooksById *hooks_by_id; + GQuark channel; } LttvHooksByIdChannel; typedef struct _LttvHooksByIdChannelArray { - GArray *array; /* Array of LttvHooksByIdChannel */ + GArray *array; /* Array of LttvHooksByIdChannel */ } LttvHooksByIdChannelArray; LttvHooksByIdChannelArray *lttv_hooks_by_id_channel_new(void); @@ -182,6 +184,12 @@ LttvHooksByIdChannelArray *lttv_hooks_by_id_channel_new(void); void lttv_hooks_by_id_channel_destroy(LttvHooksByIdChannelArray *h); LttvHooks *lttv_hooks_by_id_channel_find(LttvHooksByIdChannelArray *h, - GQuark channel, guint16 id); + GQuark channel, guint16 id); + +#endif /* BABEL_CLEANUP */ + +/* Print information about each hook in the list*/ + +void lttv_hooks_print(const LttvHooks *h); #endif // HOOK_H