mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] string: add isempty helper
@ 2024-03-13 19:45 Marco Felsch
  2024-03-13 19:45 ` [PATCH 2/4] common: env: make use of isempty() Marco Felsch
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Marco Felsch @ 2024-03-13 19:45 UTC (permalink / raw)
  To: barebox

This adds systemd's isempty() helper which can be very handy.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 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




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-04 13:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 19:45 [PATCH 1/4] string: add isempty helper Marco Felsch
2024-03-13 19:45 ` [PATCH 2/4] common: env: make use of isempty() Marco Felsch
2024-03-13 19:45 ` [PATCH 3/4] common: hostname: validate the provided hostname Marco Felsch
2024-03-13 19:45 ` [PATCH 4/4] bootm: add global.bootm.provide_hostname option Marco Felsch
2024-03-14  6:15   ` Ahmad Fatoum
2024-03-20 10:48     ` Marco Felsch
2024-04-04 13:40 ` [PATCH 1/4] string: add isempty helper Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox