From 88df24c1ae2b4acd53d234595c758b643372a4a7 Mon Sep 17 00:00:00 2001 From: venaas Date: Fri, 22 Jun 2007 13:29:31 +0000 Subject: 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 --- list.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'list.c') 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; -- cgit v1.1