[libc-commits] [libc] [libc] Provide sys/queue.h (PR #78081)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Wed Jan 17 08:59:36 PST 2024
================
@@ -35,21 +52,37 @@
#define SLIST_FOREACH(var, head, field) \
for ((var) = SLIST_FIRST(head); (var); (var) = SLIST_NEXT(var, field))
+#define SLIST_FOREACH_FROM(var, head, field) \
+ for ((var) = ((var) ? (var) : SLIST_FIRST(head)); (var); \
+ (var) = SLIST_NEXT(var, field))
----------------
nickdesaulniers wrote:
The self assignment is gross. Mind making this:
```c
if (!var) \
var = SLIST_FIRST(HEAD); \
for (;(var); ... \
```
https://github.com/llvm/llvm-project/pull/78081
More information about the libc-commits
mailing list