]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Refactor IL_CLEAR to avoid using IL_EACH which is now incompatible with it. As bonus...
authorterencehill <piuntn@gmail.com>
Fri, 17 Mar 2023 18:15:50 +0000 (19:15 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 17 Mar 2023 18:15:50 +0000 (19:15 +0100)
qcsrc/lib/intrusivelist.qh

index 7c4728a322e683845f1a4f296b309907d7debbf9..c328a603266590d311941ac39b60389db7211399 100644 (file)
@@ -153,11 +153,17 @@ void IL_REMOVE(IntrusiveList this, entity it)
  */
 #define IL_CLEAR(this) \
        MACRO_BEGIN \
-               IntrusiveList __il = this; \
-               assert(__il); \
-               .entity il_prev = __il.il_prevfld; \
-               IL_EACH(__il, true, it.(il_next) = it.(il_prev) = NULL); \
-               __il.il_head = __il.il_tail = NULL; \
+               IntrusiveList _il = this; \
+               assert(_il); \
+               .entity il_prev = _il.il_prevfld; \
+               .entity il_next = _il.il_nextfld; \
+               noref int i = 0; \
+               for (entity _next, _it = _il.il_head; _it; (_it = _next, ++i)) \
+               { \
+                       _next = _it.(il_next); \
+                       _it.(il_next) = _it.(il_prev) = NULL; \
+               } \
+               _il.il_head = _il.il_tail = NULL; \
        MACRO_END
 
 /**