summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-08-29 09:25:53 (GMT)
committer Simon <simon@hardwired.org.uk>2010-08-29 09:25:53 (GMT)
commitc0563111f822f5253264c7805917a864e1ddda5d (patch)
treec27c0eedd1f9bd96a8e849ab8940c9f4f27667c9 /misc.c
parenta23f3777314312f8dfb70b779258dbb2f948bd08 (diff)
downloadpowder-c0563111f822f5253264c7805917a864e1ddda5d.zip
powder-c0563111f822f5253264c7805917a864e1ddda5d.tar.gz
Include some headers and move some functions
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index ade3c3c..a74b0e4 100644
--- a/misc.c
+++ b/misc.c
@@ -52,4 +52,32 @@ char *mystrdup(char *s)
return x;
}
return s;
+}
+
+void strlist_add(struct strlist **list, char *str)
+{
+ struct strlist *item = malloc(sizeof(struct strlist));
+ item->str = mystrdup(str);
+ item->next = *list;
+ *list = item;
+}
+
+int strlist_find(struct strlist **list, char *str)
+{
+ struct strlist *item;
+ for(item=*list; item; item=item->next)
+ if(!strcmp(item->str, str))
+ return 1;
+ return 0;
+}
+
+void strlist_free(struct strlist **list)
+{
+ struct strlist *item;
+ while(*list)
+ {
+ item = *list;
+ *list = (*list)->next;
+ free(item);
+ }
} \ No newline at end of file