mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] string: add isempty helper
Date: Wed, 13 Mar 2024 20:45:44 +0100	[thread overview]
Message-ID: <20240313194547.3725723-1-m.felsch@pengutronix.de> (raw)

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




             reply	other threads:[~2024-03-13 19:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 19:45 Marco Felsch [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240313194547.3725723-1-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox