aboutsummaryrefslogtreecommitdiff
path: root/common/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/list.c')
-rw-r--r--common/list.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c
index 1a86837..d38daa0 100644
--- a/common/list.c
+++ b/common/list.c
@@ -74,3 +74,12 @@ void *list_pop_front(struct list *list) {
list_del(list, 0);
return item;
}
+
+void *list_pop_back(struct list *list) {
+ if (list->length == 0) {
+ return NULL;
+ }
+ void *item = list->items[list->length - 1];
+ list->length -= 1;
+ return item;
+}