# HG changeset patch # User Mike Becker # Date 1642875004 -3600 # Node ID b182a8b8a1afd579a1adf10a7759a1203f3321e2 # Parent 1a07e24801a97ab3d6e5659240d5847deea15130 pointer type must be explicit in cx_foreach macro diff -r 1a07e24801a9 -r b182a8b8a1af src/cx/iterator.h --- a/src/cx/iterator.h Sat Jan 22 19:04:32 2022 +0100 +++ b/src/cx/iterator.h Sat Jan 22 19:10:04 2022 +0100 @@ -138,6 +138,6 @@ * @param iter the iterator */ #define cx_foreach(type, elem, iter) \ -for (type *elem; cxIteratorValid(&iter) && (elem = cxIteratorCurrent(&iter)) != NULL ; cxIteratorNext(&iter)) // NOLINT(bugprone-macro-parentheses) +for (type elem; cxIteratorValid(&iter) && (elem = cxIteratorCurrent(&iter)) != NULL ; cxIteratorNext(&iter)) // NOLINT(bugprone-macro-parentheses) #endif /* UCX_ITERATOR_H */ diff -r 1a07e24801a9 -r b182a8b8a1af test/test_list.c --- a/test/test_list.c Sat Jan 22 19:04:32 2022 +0100 +++ b/test/test_list.c Sat Jan 22 19:10:04 2022 +0100 @@ -762,10 +762,10 @@ void test_hl_linked_list_iterator_impl(CxList list) { int i = 0; CxIterator iter = cxListBegin(list); - cx_foreach(int, x, iter) { + cx_foreach(int*, x, iter) { CU_ASSERT_EQUAL(iter.index, (size_t) (i + 1) / 2) CU_ASSERT_EQUAL(*x, i) - if (i % 2 == 1) iter.remove = true; + if (*x % 2 == 1) iter.remove = true; i++; } CU_ASSERT_EQUAL(i, 10)