|
From: <cli...@li...> - 2007-05-16 14:08:49
|
Revision: 53
http://cligg.svn.sourceforge.net/cligg/?rev=53&view=rev
Author: sithhell
Date: 2007-05-16 07:08:44 -0700 (Wed, 16 May 2007)
Log Message:
-----------
everything, to this point should work now, memroy leaks could still be there
Modified Paths:
--------------
src/bin/cligg.c
src/bin/cligg_eventhandler.c
src/bin/cligg_mainloop.c
src/lib/cligg_btree.c
src/lib/cligg_hashmap.c
Modified: src/bin/cligg.c
===================================================================
--- src/bin/cligg.c 2007-05-16 09:41:33 UTC (rev 52)
+++ src/bin/cligg.c 2007-05-16 14:08:44 UTC (rev 53)
@@ -47,6 +47,8 @@
ret = cligg_init_handler();
if(!ret)
exit(EXIT_FAILURE);
+
+ /* TODO register basic events */
/* init module system */
ret = cligg_init_modulehandler();
@@ -54,7 +56,7 @@
if(!cligg_trigger_event("test", NULL))
fprintf(stderr, "Error laoding module\n");
- cligg_trigger_event("load_module", NULL);
+ cligg_trigger_event("load_module", "test");
/* TODO load the config */
@@ -62,13 +64,11 @@
/* TODO define own signal handlers */
- /* TODO register basic events */
-
/* starting the event loop */
cligg_main_begin();
/* MAGIC!! */
ret = cligg_main_end();
-
+printf("blubb\n");
/* Clean up */
cligg_delete_handler();
cligg_del_modulehandler();
Modified: src/bin/cligg_eventhandler.c
===================================================================
--- src/bin/cligg_eventhandler.c 2007-05-16 09:41:33 UTC (rev 52)
+++ src/bin/cligg_eventhandler.c 2007-05-16 14:08:44 UTC (rev 53)
@@ -59,8 +59,6 @@
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;
@@ -154,9 +152,9 @@
{
cligg_event_cb ret;
cligg_event_function *new;
- cligg_event_function *tmp = cligg_event_function_new(name, NULL);
- if(tmp == NULL)
- return NULL;
+ 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");
@@ -164,7 +162,7 @@
}
new = (cligg_event_function *)cligg_hashmap_get_element(event_map, tmp);
- cligg_event_function_del(tmp);
+ cligg_event_function_del(tmp);
if(new == NULL) ret = NULL;
else ret = new->event_cb;
Modified: src/bin/cligg_mainloop.c
===================================================================
--- src/bin/cligg_mainloop.c 2007-05-16 09:41:33 UTC (rev 52)
+++ src/bin/cligg_mainloop.c 2007-05-16 14:08:44 UTC (rev 53)
@@ -43,16 +43,18 @@
cligg_loop(void *arg)
{
cligg_event_data *new;
- cligg_event_cb cb;
+ cligg_event_cb cb = NULL;
while(TRUE) {
new = cligg_waiton_event();
if(new == NULL)
return (void *)EXIT_FAILURE;
+
+ /*printf("%s: %x\n", new->name, cb);*/
cb = cligg_lookup_event(new->name);
- printf("%s: %x\n", new->name, cb);
+ /*printf("%s: %x\n", new->name, cb);*/
if(cb == NULL) continue;
Modified: src/lib/cligg_btree.c
===================================================================
--- src/lib/cligg_btree.c 2007-05-16 09:41:33 UTC (rev 52)
+++ src/lib/cligg_btree.c 2007-05-16 14:08:44 UTC (rev 53)
@@ -85,7 +85,6 @@
new->right = NULL;
new->left = NULL;
new->data = data;
-
tmp2 = tree->root;
while(tmp2) {
tmp1 = tmp2;
Modified: src/lib/cligg_hashmap.c
===================================================================
--- src/lib/cligg_hashmap.c 2007-05-16 09:41:33 UTC (rev 52)
+++ src/lib/cligg_hashmap.c 2007-05-16 14:08:44 UTC (rev 53)
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <cligg_hashmap.h>
-#include <cligg_event.h>
static int
cmp(void *_a,
@@ -63,6 +62,8 @@
void *data)
{
cligg_hashmap_element *new = (cligg_hashmap_element *)malloc(sizeof(cligg_hashmap_element));
+ if(!new)
+ return FALSE;
new->hash = map->hash_func(data);
new->data = data;
@@ -92,8 +93,7 @@
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 ((cligg_hashmap_element *)find->data)->data;
}
return NULL;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|