diff options
author | venaas <venaas> | 2007-09-18 15:06:15 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2007-09-18 15:06:15 +0000 |
commit | 7dd66d70b0470b76b44eb5416f143f080789b27a (patch) | |
tree | 80bd1a2320b4e32b19193059693fce3343c90437 /list.c | |
parent | 64564a6f7d0d84722f3300173a0d0bbb238dafd4 (diff) |
now changed to allow prefix/prefixlen for host
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@159 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'list.c')
-rw-r--r-- | list.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -52,12 +52,40 @@ void *list_shift(struct list *list) { node = list->first; list->first = node->next; + if (!list->first) + list->last = NULL; data = node->data; free(node); return data; } +/* removes first entry with matching data pointer */ +void list_removedata(struct list *list, void *data) { + struct list_node *node, *t; + + if (!list->first) + return; + + node = list->first; + if (node->data == data) { + list->first = node->next; + if (!list->first) + list->last = NULL; + free(node); + return; + } + for (; node->next; node = node->next) + if (node->next->data == data) { + t = node->next; + node->next = node->next->next; + if (!node->next) /* we removed the last one */ + list->last = node; + free(t); + return; + } +} + /* returns first node */ struct list_node *list_first(struct list *list) { return list->first; |