summaryrefslogtreecommitdiffstats
path: root/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'list.c')
-rw-r--r--list.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/list.c b/list.c
index 7e7f732..a6e5e83 100644
--- a/list.c
+++ b/list.c
@@ -90,6 +90,24 @@ void* llist_pop( struct List *list )
return NULL;
}
+void* llist_popf( struct List *list )
+{
+ void *ptr = NULL;
+ struct ListNode *node = list->first;
+ struct ListNode *next;
+ if ( node )
+ {
+ next = node->next;
+
+ list->count -= 1;
+ list->first = next;
+ if ( list->first == NULL )
+ list->last = NULL;
+ ptr = node->val;
+ free( node );
+ }
+ return ptr;
+}
void llist_push( struct List *list, void *ptr )
{