directory creation
[lttv.git] / ltt / branches / poly / lttv / hook.c
index 12f121986606473f211a86a533c648f4d2c66e8f..8edbb2afbee7fc34755a6508c5ae704211c875dc 100644 (file)
@@ -1,8 +1,9 @@
+
 #include <lttv/hook.h>
 
 
 typedef struct _LttvHookClosure {
-  lttv_hook hook;
+  LttvHook hook;
   void *hook_data;
 } LttvHookClosure;
 
@@ -15,6 +16,7 @@ LttvHooks *lttv_hooks_new()
 
 void lttv_hooks_destroy(LttvHooks *h) 
 {
+  g_critical("lttv_hooks_destroy()");
   g_array_free(h, TRUE);
 }
 
@@ -35,6 +37,7 @@ void lttv_hooks_add_list(LttvHooks *h, LttvHooks *list)
 {
   guint i;
 
+  if(list == NULL) return;
   for(i = 0 ; i < list->len; i++) {
     g_array_append_val(h,g_array_index(list, LttvHookClosure, i));
   }
@@ -83,6 +86,7 @@ void lttv_hooks_remove_list(LttvHooks *h, LttvHooks *list)
 
   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);
@@ -121,25 +125,28 @@ void lttv_hooks_get(LttvHooks *h, unsigned i, LttvHook *f, void **hook_data)
 }
 
 
-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;
 }
 
 
@@ -147,6 +154,8 @@ gboolean lttv_hooks_call_check(LttvHooks *h, void *call_data)
 {
   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;
@@ -172,7 +181,7 @@ void lttv_hooks_by_id_destroy(LttvHooksById *h)
 }
 
 
-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();
This page took 0.025077 seconds and 4 git commands to generate.