added free functions to free everything (maybe a restart function later?)
[NeonServV5.git] / IRCEvents.c
index c0b7eacea9fb9c080a8d7331a99d5a178d130209..51e0d326563a2db02cc68415976b7e5f1a474ea2 100644 (file)
@@ -33,6 +33,18 @@ void init_bind() {
     binds = calloc(TOTAL_BIND_TYPES, sizeof(*binds));
 }
 
+void free_bind() {
+    struct binding *cbind, *next;
+    int i;
+    for(i = 0; i < TOTAL_BIND_TYPES; i++) {
+        for(cbind = binds[i]; cbind; cbind = next) {
+            next = cbind->next;
+            free(cbind);
+        }
+    }
+    free(binds);
+}
+
 static int is_bound(unsigned char type, void *func) {
     struct binding *cbind;
     for(cbind = binds[type]; cbind; cbind = cbind->next) {