[PATCH] globalvar: When a globalvar is created with a NULL value, use empty string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux