From: Yu Watanabe Date: Sun, 19 Mar 2023 14:32:43 +0000 (+0900) Subject: strv: introduce strv_print_full() X-Git-Tag: v254-rc1~977 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00546c18fd2555e6140f17b307c45ac487e0c5ad;p=thirdparty%2Fsystemd.git strv: introduce strv_print_full() --- diff --git a/src/basic/strv.c b/src/basic/strv.c index 9b4a7663a90..5fcf3620a60 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -668,9 +668,9 @@ int strv_compare(char * const *a, char * const *b) { return 0; } -void strv_print(char * const *l) { +void strv_print_full(char * const *l, const char *prefix) { STRV_FOREACH(s, l) - puts(*s); + printf("%s%s\n", strempty(prefix), *s); } int strv_extendf(char ***l, const char *format, ...) { diff --git a/src/basic/strv.h b/src/basic/strv.h index 49e1c3d8b13..419cda1ee3f 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -149,7 +149,10 @@ bool strv_overlap(char * const *a, char * const *b) _pure_; _STRV_FOREACH_PAIR(x, y, l, UNIQ_T(i, UNIQ)) char** strv_sort(char **l); -void strv_print(char * const *l); +void strv_print_full(char * const *l, const char *prefix); +static inline void strv_print(char * const *l) { + strv_print_full(l, NULL); +} #define strv_from_stdarg_alloca(first) \ ({ \