This adds systemd's isempty() helper which can be very handy. Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- include/string.h | 2 ++ lib/string.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/string.h b/include/string.h index 43911b75762f..ffe7c42d3093 100644 --- a/include/string.h +++ b/include/string.h @@ -20,4 +20,6 @@ char *parse_assignment(char *str); int strverscmp(const char *a, const char *b); +bool isempty(const char *s); + #endif /* __STRING_H */ diff --git a/lib/string.c b/lib/string.c index bf0f0455ab3f..20e6947347de 100644 --- a/lib/string.c +++ b/lib/string.c @@ -1000,3 +1000,9 @@ char *parse_assignment(char *str) return value; } + +bool isempty(const char *s) +{ + return !s || s[0] == '\0'; +} +EXPORT_SYMBOL(isempty); -- 2.39.2