fixed last commit
authorpk910 <philipp@zoelle1.de>
Fri, 12 Aug 2011 22:37:29 +0000 (00:37 +0200)
committerpk910 <philipp@zoelle1.de>
Fri, 12 Aug 2011 22:37:29 +0000 (00:37 +0200)
modcmd.c
modcmd.h

index 180c9689ccf4bf523ae26b7f69d114d78626c0b6..bd39a47bf43455ac15a125e99813ee2181f0df80 100644 (file)
--- a/modcmd.c
+++ b/modcmd.c
@@ -163,21 +163,21 @@ int changeChannelTrigger(int botid, struct ChanNode *chan, char *new_trigger) {
 
 int bind_cmd_to_function(int botid, char *cmd, struct cmd_function *func) {
     int bind_index = get_binds_index(cmd[0]);
-    struct cmd_binding *bind;
-    for(bind = cmd_binds[bind_index]; bind; bind = bind->next) {
-        if(bind->botid == botid && strcmp(bind->cmd, cmd) == 0)
+    struct cmd_binding *cbind;
+    for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) {
+        if(cbind->botid == botid && strcmp(cbind->cmd, cmd) == 0)
             return 0;
     }
-    bind = malloc(sizeof(*bind));
-    if (!bind) {
+    cbind = malloc(sizeof(*cbind));
+    if (!cbind) {
         perror("malloc() failed");
         return 0;
     }
-    bind->botid = botid;
-    bind->cmd = strdup(cmd);
-    bind->func = func;
-    bind->next = cmd_binds[bind_index];
-    cmd_binds[bind_index] = bind;
+    cbind->botid = botid;
+    cbind->cmd = strdup(cmd);
+    cbind->func = func;
+    cbind->next = cmd_binds[bind_index];
+    cmd_binds[bind_index] = cbind;
     return 1;
 }
 
@@ -189,38 +189,38 @@ int bind_cmd_to_command(int botid, char *cmd, char *func) {
     }
     if(!cmdfunc) return 0;
     int bind_index = get_binds_index(cmd[0]);
-    struct cmd_binding *bind;
-    for(bind = cmd_binds[bind_index]; bind; bind = bind->next) {
-        if(bind->botid == botid && strcmp(bind->cmd, cmd) == 0)
+    struct cmd_binding *cbind;
+    for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) {
+        if(cbind->botid == botid && strcmp(cbind->cmd, cmd) == 0)
             return 0;
     }
-    bind = malloc(sizeof(*bind));
-    if (!bind) {
+    cbind = malloc(sizeof(*cbind));
+    if (!cbind) {
         perror("malloc() failed");
         return 0;
     }
-    bind->botid = botid;
-    bind->cmd = strdup(cmd);
-    bind->func = cmdfunc;
-    bind->next = cmd_binds[bind_index];
-    cmd_binds[bind_index] = bind;
+    cbind->botid = botid;
+    cbind->cmd = strdup(cmd);
+    cbind->func = cmdfunc;
+    cbind->next = cmd_binds[bind_index];
+    cmd_binds[bind_index] = cbind;
     return 1;
 }
 
 int unbind_cmd(int botid, char *cmd) {
     int bind_index = get_binds_index(cmd[0]);
-    struct cmd_binding *bind, *last = NULL;
-    for(bind = cmd_binds[bind_index]; bind; bind = bind->next) {
-        if(bind->botid == botid && strcmp(bind->cmd, cmd) == 0) {
+    struct cmd_binding *cbind, *last = NULL;
+    for(cbind = cmd_binds[bind_index]; cbind; cbind = cbind->next) {
+        if(cbind->botid == botid && strcmp(cbind->cmd, cmd) == 0) {
             if(last)
-                last->next = bind->next;
+                last->next = cbind->next;
             else
-                cmd_binds[bind_index] = bind->next;
-            free(bind->cmd);
-            free(bind);
+                cmd_binds[bind_index] = cbind->next;
+            free(cbind->cmd);
+            free(cbind);
             return 1;
         } else
-            last = bind;
+            last = cbind;
     }
     return 0;
 }
index 4bff7d9110ddc47c6fa7a7ca5510c820bf671a9b..673f74c92716c9c1c1b2a3509b67539d843da911 100644 (file)
--- a/modcmd.h
+++ b/modcmd.h
@@ -14,8 +14,8 @@ struct cmd_function {
     int botid;
     cmd_bind_t *func;
     
-    struct cmd_binding *next;
-}
+    struct cmd_function *next;
+};
 
 struct cmd_binding {
     char *cmd;
@@ -23,14 +23,14 @@ struct cmd_binding {
     struct cmd_function *func;
     
     struct cmd_binding *next;
-}
+};
 
 struct trigger_cache {
     int botid;
     char *trigger;
     
     struct trigger_cache *next;
-}
+};
 
 void init_modcmd();
 struct* ClientSocket get_prefered_bot(int botid);