strv: Move STRV_FOREACH() to strv-fundamental.h

This commit is contained in:
Daan De Meyer
2025-05-07 21:43:39 +02:00
parent 56c710ce37
commit 5f142e01d0
6 changed files with 14 additions and 6 deletions

View File

@@ -9,6 +9,7 @@
#include "alloc-util.h"
#include "hashmap.h"
#include "memory-util.h"
#include "strv-fundamental.h"
typedef enum ExtractFlags ExtractFlags;

View File

@@ -24,6 +24,7 @@
#include "stat-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "virt.h"
enum {

View File

@@ -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"

View File

@@ -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';

View File

@@ -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))

View File

@@ -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"