summaryrefslogtreecommitdiffstats
path: root/commands/nv.c
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2020-11-26 19:31:54 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-11-27 10:02:36 +0100
commit8f57bc80c3e6a9f1c5318b52b98e9cc3268d10a8 (patch)
tree4bdd637c26eeacb9928cf36f2e91ca09a5084c6b /commands/nv.c
parent870f45338872b5ac02b2f87b6409036a6292ecf3 (diff)
downloadbarebox-8f57bc80c3e6a9f1c5318b52b98e9cc3268d10a8.tar.gz
barebox-8f57bc80c3e6a9f1c5318b52b98e9cc3268d10a8.tar.xz
commands: implement and use parse_assignment helper
We have the split by '=' snippet at multiple locations that parse key=value pairs. Consolidate them to a single location. This makes code a bit easier to read at the cost of an extra 8 bytes (LZO-compressed THUMB2 barebox, static inline version is bigger). No functional change. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/nv.c')
-rw-r--r--commands/nv.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/commands/nv.c b/commands/nv.c
index a1cff08ee4..c60bb41677 100644
--- a/commands/nv.c
+++ b/commands/nv.c
@@ -55,13 +55,8 @@ static int do_nv(int argc, char *argv[])
for (i = 0; i < argc; i++) {
int ret;
- value = strchr(argv[i], '=');
- if (value) {
- *value = 0;
- value++;
- } else {
- value = "";
- }
+
+ value = parse_assignment(argv[i]) ?: "";
if (do_remove) {
ret = nvvar_remove(argv[i]);