[libc-commits] [libc] [libc] Provide sys/queue.h (PR #78081)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Wed Jan 17 09:57:50 PST 2024


================
@@ -131,11 +217,23 @@
     (head)->last = &STAILQ_NEXT(elem, field);                                  \
   } while (0)
 
-#define STAILQ_INSERT_AFTER(head, listelem, elem, field)                       \
+#define STAILQ_REMOVE(head, elem, type, field)                                 \
   do {                                                                         \
-    if ((STAILQ_NEXT(elem, field) = STAILQ_NEXT(listelem, field)) == NULL)     \
+    if (STAILQ_FIRST(head) == (elem)) {                                        \
+      STAILQ_REMOVE_HEAD(head, field);                                         \
+    } else {                                                                   \
+      QUEUE_TYPEOF(type) *cur = STAILQ_FIRST(head);                            \
+      while (STAILQ_NEXT(elem, field) != (elem))                               \
----------------
petrhosek wrote:

Done.

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


More information about the libc-commits mailing list