]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "basic/allow-util: make free_many non-inline"
authorMike Yuan <me@yhndnzj.com>
Thu, 26 Mar 2026 16:23:47 +0000 (17:23 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 25 Jul 2026 10:37:47 +0000 (19:37 +0900)
This reverts commit 3abe1e53f657982a7a6ab6861cf0b3962cbbb3b5.

I remain unconvinced. The function is very short, and
by making it inline the assert()s can be optimized away.

src/basic/alloc-util.c
src/basic/alloc-util.h

index 3a813575c3afd30981e8249fb75923c6cd7d66ee..04c4a506729d4cda5cb32cc75180667ce3eaecae 100644 (file)
@@ -164,10 +164,3 @@ void* greedy_realloc_append(
 
         return q;
 }
-
-void free_many(void **p, size_t n) {
-        assert(p || n == 0);
-
-        FOREACH_ARRAY(i, p, n)
-                *i = mfree(*i);
-}
index 1f0342eda3f2cde08c6482d491a3c25c63251d99..8505205ce3cac33fddb80114357cce8c77044f5e 100644 (file)
@@ -208,7 +208,12 @@ void* greedy_realloc_append(void **p, size_t *n_p, const void *from, size_t n_fr
 #endif
 
 /* Free every element of the array. */
-void free_many(void **p, size_t n);
+static inline void free_many(void **p, size_t n) {
+        assert(p || n == 0);
+
+        FOREACH_ARRAY(i, p, n)
+                *i = mfree(*i);
+}
 
 /* Typesafe wrapper for char** rather than void**. Unfortunately C won't implicitly cast this. */
 static inline void free_many_charp(char **c, size_t n) {