Fix ptree_for_each_element loop termination condition (#319)

Daemon tested, starts successfully
This commit is contained in:
Levi Neely 2026-03-03 15:29:44 +01:00 committed by GitHub
parent ac25de2831
commit d0d9ac2d77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -49,8 +49,9 @@ typedef struct _psync_tree {
#define ptree_for_each(a, l) \ #define ptree_for_each(a, l) \
for (a = ptree_get_first(l); a != NULL; a = ptree_get_next(a)) for (a = ptree_get_first(l); a != NULL; a = ptree_get_next(a))
#define ptree_for_each_element(a, l, t, n) \ #define ptree_for_each_element(a, l, t, n) \
for (a = ptree_element(ptree_get_first(l), t, n); &a->n != NULL; \ for (a = (ptree_get_first(l) ? ptree_element(ptree_get_first(l), t, n) : NULL); \
a = ptree_element(ptree_get_next(&a->n), t, n)) a != NULL; \
a = (ptree_get_next(&a->n) ? ptree_element(ptree_get_next(&a->n), t, n) : NULL))
#define ptree_for_each_element_call(l, t, n, c) \ #define ptree_for_each_element_call(l, t, n, c) \
do { \ do { \