fix of last commit
authorpk910 <philipp@zoelle1.de>
Fri, 12 Aug 2011 13:57:13 +0000 (15:57 +0200)
committerpk910 <philipp@zoelle1.de>
Fri, 12 Aug 2011 13:57:13 +0000 (15:57 +0200)
IRCEvents.c

index 8ea279a7983c483e6e9e375186dc4cbf2a3115cd..d4fe259c27a35a90d03a8e20a8b06bb312ad80b4 100644 (file)
@@ -43,22 +43,22 @@ static int is_bound(unsigned char type, void *func) {
 }
 
 #define FUNC_BIND(NAME,FUNCTYPE,TYPE) \
-int bind_NAME(FUNCTYPE *func) { \
+int bind_##NAME(FUNCTYPE *func) { \
     if(!is_bound(TYPE, func)) { \
-        struct binding *bind = malloc(sizeof(*bind)); \
-        if (!bind) { \
+        struct binding *cbind = malloc(sizeof(*cbind)); \
+        if (!cbind) { \
             perror("malloc() failed"); \
             return 0; \
         } \
-        bind->func = func; \
-        bind->next = binds[TYPE]; \
-        binds[TYPE] = bind; \
+        cbind->func = func; \
+        cbind->next = binds[TYPE]; \
+        binds[TYPE] = cbind; \
         return 1; \
     } \
 }
 
 #define FUNC_UNBIND(NAME,FUNCTYPE,TYPE) \
-void unbind_NAME(FUNCTYPE *func) { \
+void unbind_##NAME(FUNCTYPE *func) { \
     struct binding *cbind, *last = NULL, *next; \
     for(cbind = binds[TYPE]; cbind; cbind = next) { \
         next = cbind->next; \
@@ -66,7 +66,7 @@ void unbind_NAME(FUNCTYPE *func) { \
             if(last) \
                 last->next = cbind->next; \
             else \
-                binds[TYPE] = cbind->next \
+                binds[TYPE] = cbind->next; \
             free(cbind); \
         } else \
             last = cbind; \
@@ -74,7 +74,7 @@ void unbind_NAME(FUNCTYPE *func) { \
 }
 
 #define FUNC_EVENT(NAME,FUNCTYPE,TYPE,PDECLARATION,PLIST) \
-int event_NAME(PDECLARATION) { \
+int event_##NAME(PDECLARATION) { \
     struct binding *cbind; \
     for(cbind = binds[TYPE]; cbind; cbind = next) { \
         FUNCTYPE *func = cbind->func; \