summaryrefslogtreecommitdiffstats
path: root/common/hush.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 /common/hush.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 'common/hush.c')
-rw-r--r--common/hush.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/common/hush.c b/common/hush.c
index a6fc4485bf..109bae4d3f 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1117,12 +1117,11 @@ static int set_local_var(const char *s, int flg_export)
/* Assume when we enter this function that we are already in
* NAME=VALUE format. So the first order of business is to
* split 's' on the '=' into 'name' and 'value' */
- value = strchr(name, '=');
+ value = parse_assignment(name);
if (!value) {
free(name);
return -1;
}
- *value++ = 0;
remove_quotes_in_str(value);