From bc952b51f48905392cec5685853fbb44565057a8 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 20 May 2023 14:37:56 -0400 Subject: list: Return the removed item from SLIST_POP() --- src/bftw.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/bftw.c') diff --git a/src/bftw.c b/src/bftw.c index 6ec5cfa..966f03d 100644 --- a/src/bftw.c +++ b/src/bftw.c @@ -780,8 +780,7 @@ static bool bftw_pop_dir(struct bftw_state *state) { return false; } - state->file = state->dirs.head; - SLIST_POP(&state->dirs); + state->file = SLIST_POP(&state->dirs); return true; } @@ -952,8 +951,7 @@ static void bftw_list_sort(struct bftw_list *list) { // Split for (struct bftw_file *hare = list->head; hare && (hare = hare->next); hare = hare->next) { - struct bftw_file *tortoise = list->head; - SLIST_POP(list); + struct bftw_file *tortoise = SLIST_POP(list); SLIST_APPEND(&left, tortoise); } SLIST_EXTEND(&right, list); -- cgit v1.2.3