From: Daan De Meyer Date: Wed, 7 May 2025 19:43:39 +0000 (+0200) Subject: strv: Move STRV_FOREACH() to strv-fundamental.h X-Git-Tag: v258-rc1~656^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F37381%2Fhead;p=thirdparty%2Fsystemd.git strv: Move STRV_FOREACH() to strv-fundamental.h --- diff --git a/src/basic/strv.h b/src/basic/strv.h index 08bcaea8b9b..b7895cbf1b2 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -9,6 +9,7 @@ #include "alloc-util.h" #include "hashmap.h" #include "memory-util.h" +#include "strv-fundamental.h" typedef enum ExtractFlags ExtractFlags; diff --git a/src/basic/virt.c b/src/basic/virt.c index e07cee72cf5..5717a1d2b41 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -24,6 +24,7 @@ #include "stat-util.h" #include "string-table.h" #include "string-util.h" +#include "strv.h" #include "virt.h" enum { diff --git a/src/boot/boot.c b/src/boot/boot.c index 99d83f54628..0e24beff6a2 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -29,6 +29,7 @@ #include "secure-boot.h" #include "shim.h" #include "smbios.h" +#include "strv-fundamental.h" #include "ticks.h" #include "tpm2-pcr.h" #include "uki.h" diff --git a/src/fundamental/string-util-fundamental.h b/src/fundamental/string-util-fundamental.h index b523b6c8bf9..ff74a80a183 100644 --- a/src/fundamental/string-util-fundamental.h +++ b/src/fundamental/string-util-fundamental.h @@ -120,12 +120,6 @@ static inline void *memory_startswith(const void *p, size_t sz, const sd_char *t return (uint8_t*) p + n; } -#define _STRV_FOREACH(s, l, i) \ - for (typeof(*(l)) *s, *i = (l); (s = i) && *i; i++) - -#define STRV_FOREACH(s, l) \ - _STRV_FOREACH(s, l, UNIQ_T(i, UNIQ)) - static inline bool ascii_isdigit(sd_char a) { /* A pure ASCII, locale independent version of isdigit() */ return a >= '0' && a <= '9'; diff --git a/src/fundamental/strv-fundamental.h b/src/fundamental/strv-fundamental.h new file mode 100644 index 00000000000..3abcdc4b02e --- /dev/null +++ b/src/fundamental/strv-fundamental.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +#include "macro-fundamental.h" + +#define _STRV_FOREACH(s, l, i) \ + for (typeof(*(l)) *s, *i = (l); (s = i) && *i; i++) + +#define STRV_FOREACH(s, l) \ + _STRV_FOREACH(s, l, UNIQ_T(i, UNIQ)) diff --git a/src/sysupdate/sysupdate-pattern.c b/src/sysupdate/sysupdate-pattern.c index 1266bc7295a..82b00d3d3b0 100644 --- a/src/sysupdate/sysupdate-pattern.c +++ b/src/sysupdate/sysupdate-pattern.c @@ -8,6 +8,7 @@ #include "path-util.h" #include "stdio-util.h" #include "string-util.h" +#include "strv.h" #include "sysupdate-instance.h" #include "sysupdate-pattern.h"