summaryrefslogtreecommitdiff
path: root/list.c
diff options
context:
space:
mode:
authorvenaas <venaas>2007-06-22 13:29:31 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-06-22 13:29:31 +0000
commit88df24c1ae2b4acd53d234595c758b643372a4a7 (patch)
tree1cc29bcce3d0e713e2b044115c7cee053dd7bba7 /list.c
parent7a076e9094c424c5d59560d0f84fc8d996e8fcb1 (diff)
moved to linked lists for replyqs, removed replyq size and count
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@152 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'list.c')
-rw-r--r--list.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/list.c b/list.c
index 578c61a..e9dcebb 100644
--- a/list.c
+++ b/list.c
@@ -23,7 +23,7 @@ void list_destroy(struct list *list) {
}
/* appends entry to list; returns 1 if ok, 0 if malloc fails */
-int list_add(struct list *list, void *data) {
+int list_push(struct list *list, void *data) {
struct list_node *node;
node = malloc(sizeof(struct list_node));
@@ -42,6 +42,22 @@ int list_add(struct list *list, void *data) {
return 1;
}
+/* removes first entry from list and returns data */
+void *list_shift(struct list *list) {
+ struct list_node *node;
+ void *data;
+
+ if (!list->first)
+ return NULL;
+
+ node = list->first;
+ list->first = node->next;
+ data = node->data;
+ free(node);
+
+ return data;
+}
+
/* returns first node */
struct list_node *list_first(struct list *list) {
return list->first;