+
#include <lttv/hook.h>
typedef struct _LttvHookClosure {
- lttv_hook hook;
+ LttvHook hook;
void *hook_data;
} LttvHookClosure;
void lttv_hooks_destroy(LttvHooks *h)
{
+ g_critical("lttv_hooks_destroy()");
g_array_free(h, TRUE);
}
{
guint i;
+ if(list == NULL) return;
for(i = 0 ; i < list->len; i++) {
g_array_append_val(h,g_array_index(list, LttvHookClosure, i));
}
LttvHookClosure *c, *c_list;
+ if(list == NULL) return;
for(i = 0, j = 0 ; i < h->len && j < list->len ;) {
c = &g_array_index(h, LttvHookClosure, i);
c_list = &g_array_index(list, LttvHookClosure, j);
}
-void lttv_hooks_remove_by_position(LttvHooks *h, unsigned i);
+void lttv_hooks_remove_by_position(LttvHooks *h, unsigned i)
{
- g_array_remove_index(h, i)
+ g_array_remove_index(h, i);
}
gboolean lttv_hooks_call(LttvHooks *h, void *call_data)
{
- gboolean ret = FALSE;
+ gboolean ret, sum_ret = FALSE;
LttvHookClosure *c;
+ guint i;
+
if(h != NULL) {
for(i = 0 ; i < h->len ; i++) {
c = &g_array_index(h, LttvHookClosure, i);
- ret = ret || c->hook(c->hook_data,call_data);
+ ret = c->hook(c->hook_data,call_data);
+ sum_ret = sum_ret || ret;
}
}
- return ret;
+ return sum_ret;
}
{
LttvHookClosure *c;
+ guint i;
+
for(i = 0 ; i < h->len ; i++) {
c = &g_array_index(h, LttvHookClosure, i);
if(c->hook(c->hook_data,call_data)) return TRUE;
}
-LttvHooks *lttv_hooks_by_id_find(LttvHooksById *h, unsigned id);
+LttvHooks *lttv_hooks_by_id_find(LttvHooksById *h, unsigned id)
{
if(h->len <= id) g_ptr_array_set_size(h, id + 1);
if(h->pdata[id] == NULL) h->pdata[id] = lttv_hooks_new();