aboutsummaryrefslogtreecommitdiff
path: root/lib/llist.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/llist.c')
-rw-r--r--lib/llist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/llist.c b/lib/llist.c
index 9b6c2950..7b41fd08 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -8,12 +8,14 @@
// Call a function (such as free()) on each element of a linked list.
void llist_traverse(void *list, void (*using)(void *data))
{
+ void *old = list;
+
while (list) {
void *pop = llist_pop(&list);
using(pop);
// End doubly linked list too.
- if (list==pop) break;
+ if (old == list) break;
}
}