summaryrefslogtreecommitdiff
path: root/tools/env
diff options
context:
space:
mode:
authorAndreas Fenkart <andreas.fenkart@digitalstrom.com>2016-03-11 09:39:37 +0100
committerTom Rini <trini@konsulko.com>2016-03-26 18:49:29 -0400
commit938c29ff41b40a1b6cafc9bcc81b89ad2bd537ba (patch)
tree8c8ee2c9fc2b285ed416b861beb22005fa9e8208 /tools/env
parent9583efcc74f9e781773706126315d4e9f8c9d43e (diff)
downloadu-boot-imx-938c29ff41b40a1b6cafc9bcc81b89ad2bd537ba.zip
u-boot-imx-938c29ff41b40a1b6cafc9bcc81b89ad2bd537ba.tar.gz
u-boot-imx-938c29ff41b40a1b6cafc9bcc81b89ad2bd537ba.tar.bz2
tools: env: split fw_string_blank into skip_chars / skip_blanks
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
Diffstat (limited to 'tools/env')
-rw-r--r--tools/env/fw_env.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 0a438a3..60574f2 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -133,14 +133,19 @@ static inline ulong getenvsize (void)
return rc;
}
-static char *fw_string_blank(char *s, int noblank)
+static char *skip_chars(char *s)
{
- int i;
- int len = strlen(s);
+ for (; *s != '\0'; s++) {
+ if (isblank(*s))
+ return s;
+ }
+ return NULL;
+}
- for (i = 0; i < len; i++, s++) {
- if ((noblank && !isblank(*s)) ||
- (!noblank && isblank(*s)))
+static char *skip_blanks(char *s)
+{
+ for (; *s != '\0'; s++) {
+ if (!isblank(*s))
return s;
}
return NULL;
@@ -575,17 +580,17 @@ int fw_parse_script(char *fname)
* Search for variable's name,
* remove leading whitespaces
*/
- name = fw_string_blank(dump, 1);
+ name = skip_blanks(dump);
if (!name)
continue;
/* The first white space is the end of variable name */
- val = fw_string_blank(name, 0);
+ val = skip_chars(name);
len = strlen(name);
if (val) {
*val++ = '\0';
if ((val - name) < len)
- val = fw_string_blank(val, 1);
+ val = skip_blanks(val);
else
val = NULL;
}