From: Lennart Poettering Date: Wed, 25 Mar 2026 17:08:16 +0000 (+0100) Subject: fundamental: move strv_isempty() into src/fundamental/ X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6e2a452118cf2cb0071490c8daa6829db45356e7;p=thirdparty%2Fsystemd.git fundamental: move strv_isempty() into src/fundamental/ --- diff --git a/src/basic/strv.h b/src/basic/strv.h index 7249d8a3117..d7c4b2bcf08 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -104,10 +104,6 @@ static inline const char* STRV_IFNOTNULL(const char *x) { return x ?: STRV_IGNORE; } -static inline bool strv_isempty(char * const *l) { - return !l || !*l; -} - int strv_split_full(char ***t, const char *s, const char *separators, ExtractFlags flags); char** strv_split(const char *s, const char *separators); diff --git a/src/boot/boot.c b/src/boot/boot.c index bffedf78e29..237e78c5a93 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -2547,7 +2547,7 @@ static EFI_STATUS initrd_prepare( assert(ret_initrd_pages); assert(ret_initrd_size); - if (entry->type != LOADER_LINUX || !entry->initrd) { + if (entry->type != LOADER_LINUX || strv_isempty(entry->initrd)) { *ret_options = NULL; *ret_initrd_pages = (Pages) {}; *ret_initrd_size = 0; diff --git a/src/fundamental/strv-fundamental.h b/src/fundamental/strv-fundamental.h index 3abcdc4b02e..7e7e34822f5 100644 --- a/src/fundamental/strv-fundamental.h +++ b/src/fundamental/strv-fundamental.h @@ -2,9 +2,14 @@ #pragma once #include "macro-fundamental.h" +#include "string-util-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)) + +static inline bool strv_isempty(sd_char * const *l) { + return !l || !*l; +}