|
From: <cli...@li...> - 2007-05-16 09:41:35
|
Revision: 52
http://cligg.svn.sourceforge.net/cligg/?rev=52&view=rev
Author: sithhell
Date: 2007-05-16 02:41:33 -0700 (Wed, 16 May 2007)
Log Message:
-----------
blubb
Modified Paths:
--------------
src/bin/cligg.c
src/bin/cligg_eventhandler.c
src/bin/cligg_mainloop.c
src/lib/cligg_event.c
src/lib/cligg_hashmap.c
src/lib/cligg_list.c
Modified: src/bin/cligg.c
===================================================================
--- src/bin/cligg.c 2007-05-15 21:54:32 UTC (rev 51)
+++ src/bin/cligg.c 2007-05-16 09:41:33 UTC (rev 52)
@@ -54,6 +54,8 @@
if(!cligg_trigger_event("test", NULL))
fprintf(stderr, "Error laoding module\n");
+ cligg_trigger_event("load_module", NULL);
+
/* TODO load the config */
/* TODO process the config */
@@ -69,6 +71,7 @@
/* Clean up */
cligg_delete_handler();
+ cligg_del_modulehandler();
exit(ret);
}
Modified: src/bin/cligg_eventhandler.c
===================================================================
--- src/bin/cligg_eventhandler.c 2007-05-15 21:54:32 UTC (rev 51)
+++ src/bin/cligg_eventhandler.c 2007-05-16 09:41:33 UTC (rev 52)
@@ -59,6 +59,8 @@
int ret;
cligg_event_function *new;
+ printf("%s : %x\n", name, event_cb);
+
new = cligg_event_function_new(name, event_cb);
if(new == NULL)
return FALSE;
@@ -152,19 +154,23 @@
{
cligg_event_cb ret;
cligg_event_function *new;
+ cligg_event_function *tmp = cligg_event_function_new(name, NULL);
+ if(tmp == NULL)
+ return NULL;
if(pthread_mutex_lock(&hash_lock) != 0) {
fprintf(stderr, "Couldn't obtain lock for the event map!\n");
- return FALSE;
+ return NULL;
}
- new = cligg_hashmap_get_element(event_map, name);
+ new = (cligg_event_function *)cligg_hashmap_get_element(event_map, tmp);
+ cligg_event_function_del(tmp);
if(new == NULL) ret = NULL;
else ret = new->event_cb;
if(pthread_mutex_unlock(&hash_lock) != 0) {
fprintf(stderr, "Couldn't release lock for the event map!\n");
- return FALSE;
+ return NULL;
}
return ret;
Modified: src/bin/cligg_mainloop.c
===================================================================
--- src/bin/cligg_mainloop.c 2007-05-15 21:54:32 UTC (rev 51)
+++ src/bin/cligg_mainloop.c 2007-05-16 09:41:33 UTC (rev 52)
@@ -52,6 +52,8 @@
cb = cligg_lookup_event(new->name);
+ printf("%s: %x\n", new->name, cb);
+
if(cb == NULL) continue;
if(!cb(new->data))
Modified: src/lib/cligg_event.c
===================================================================
--- src/lib/cligg_event.c 2007-05-15 21:54:32 UTC (rev 51)
+++ src/lib/cligg_event.c 2007-05-16 09:41:33 UTC (rev 52)
@@ -33,13 +33,15 @@
cligg_event_function_new(char *name,
cligg_event_cb event_cb)
{
- cligg_event_function *new = malloc(sizeof(cligg_event_function));
+ cligg_event_function *new = (cligg_event_function *)malloc(sizeof(cligg_event_function));
if(new == NULL)
return NULL;
new->name = malloc(strlen(name) * sizeof(char) + 1);
- if(new->name == NULL)
+ if(new->name == NULL) {
+ free(new);
return NULL;
+ }
strcpy(new->name, name);
@@ -53,5 +55,6 @@
cligg_event_function_del(void *event)
{
free(((cligg_event_function *)event)->name);
- free(event);
+ ((cligg_event_function *)event)->event_cb = NULL;
+ /*free(event);*/
}
Modified: src/lib/cligg_hashmap.c
===================================================================
--- src/lib/cligg_hashmap.c 2007-05-15 21:54:32 UTC (rev 51)
+++ src/lib/cligg_hashmap.c 2007-05-16 09:41:33 UTC (rev 52)
@@ -90,8 +90,10 @@
element->hash = map->hash_func(data);
element->data = data;
- find = cligg_btree_find(map->map, element);
- if(find)
- return element;
+ find = (cligg_btree_element *)cligg_btree_find(map->map, element);
+ if(find) {
+ printf("%s: %x\n", ((cligg_event_function *)find->data->)name, ((cligg_event_function *)find->data->)event_cb);
+ return find->data;
+ }
return NULL;
}
Modified: src/lib/cligg_list.c
===================================================================
--- src/lib/cligg_list.c 2007-05-15 21:54:32 UTC (rev 51)
+++ src/lib/cligg_list.c 2007-05-16 09:41:33 UTC (rev 52)
@@ -205,7 +205,8 @@
list->free_func(old->data);
}
list->first = old->next;
- list->first->prev = NULL;
+ if(list->first != NULL)
+ list->first->prev = NULL;
free(old);
list->size--;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|