diff options
Diffstat (limited to 'list.c')
-rw-r--r-- | list.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 ) { |