mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] globalvar: When a globalvar is created with a NULL value, use empty string
@ 2017-11-23 11:04 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2017-11-23 11:04 UTC (permalink / raw)
  To: Barebox List

As a convenience for users of globalvar_add_simple_string() create an
empty value for the variable when passed a NULL pointer as value.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/globalvar.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index ee756e5140..1db6bd9a41 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -459,6 +459,9 @@ int globalvar_add_simple_string(const char *name, char **value)
 
 	globalvar_nv_sync(name);
 
+	if (!*value)
+		*value = xstrdup("");
+
 	return 0;
 }
 
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-23 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-23 11:04 [PATCH] globalvar: When a globalvar is created with a NULL value, use empty string Sascha Hauer

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