From b99e1ea38e0bc7a54105905c975a4a73d6ac239c Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 12 Jan 2022 12:17:06 +1100 Subject: [PATCH] [client] ll: fix error in ll_forEachNL macro --- client/include/ll.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/include/ll.h b/client/include/ll.h index fac301d6..ac0e162f 100644 --- a/client/include/ll.h +++ b/client/include/ll.h @@ -54,9 +54,11 @@ bool ll_walk (struct ll * list, void ** data); #define ll_unlock(ll) LG_UNLOCK((ll)->lock) #define ll_forEachNL(ll, item, v) \ - for(struct ll_item * item = (ll)->head, * _ = (ll)->head->next; (item);) \ + for(struct ll_item * item = (ll)->head, \ + * _ = (item) ? (item)->next : NULL; (item); (item) = NULL) \ for((v) = (__typeof__(v))((item)->data); (item); (item) = _, \ - _ = _ ? _->next : NULL, (v) = (__typeof__(v))((item)->data)) + _ = (item) ? (item)->next : NULL, \ + (v) = (item) ? (__typeof__(v))((item)->data) : NULL) static inline unsigned int ll_count(struct ll * list) {