[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:37 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))
+
 #define SLIST_FOREACH_SAFE(var, head, field, tvar)                             \
   for ((var) = SLIST_FIRST(head);                                              \
        (var) && ((tvar) = SLIST_NEXT(var, field), 1); (var) = (tvar))
 
+#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar)                        \
+  for ((var) = ((var) ? (var) : SLIST_FIRST(head));                            \
----------------
nickdesaulniers wrote:

ditto

https://github.com/llvm/llvm-project/pull/78081


More information about the libc-commits mailing list