summaryrefslogtreecommitdiffstats
path: root/src/bftw.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-05-20 14:37:56 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-05-20 14:37:56 -0400
commitbc952b51f48905392cec5685853fbb44565057a8 (patch)
tree7c133a045684d4bdc4f023ba134f3a37b792dca6 /src/bftw.c
parentf642b3dd1271e4a1503ce7629ba36e25d6a59fce (diff)
downloadbfs-bc952b51f48905392cec5685853fbb44565057a8.tar.xz
list: Return the removed item from SLIST_POP()
Diffstat (limited to 'src/bftw.c')
-rw-r--r--src/bftw.c6
1 files changed, 2 insertions, 4 deletions
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);