diff options
author | Andreas Fenkart <andreas.fenkart@digitalstrom.com> | 2016-07-16 17:06:14 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-07-22 14:46:22 -0400 |
commit | 1b7427cd2ab6aae150559ee2edc8965fda113fdf (patch) | |
tree | 08b8891da7471f3c3f8debf54f539d97eef154d1 /tools/env/fw_env.c | |
parent | fd4e3280e50983aa4d646f2c8fc93b38cc1dddf9 (diff) | |
download | u-boot-imx-1b7427cd2ab6aae150559ee2edc8965fda113fdf.zip u-boot-imx-1b7427cd2ab6aae150559ee2edc8965fda113fdf.tar.gz u-boot-imx-1b7427cd2ab6aae150559ee2edc8965fda113fdf.tar.bz2 |
tools/env: move envmatch further up in file to avoid forward declarations
forward declaration not needed when re-ordered
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
Diffstat (limited to 'tools/env/fw_env.c')
-rw-r--r-- | tools/env/fw_env.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 1dad1ce..faba9a9 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -122,7 +122,6 @@ static unsigned char obsolete_flag = 0; #include <env_default.h> static int flash_io (int mode); -static char *envmatch (char * s1, char * s2); static int parse_config(struct env_opts *opts); #if defined(CONFIG_FILE) @@ -148,6 +147,24 @@ static char *skip_blanks(char *s) } /* + * s1 is either a simple 'name', or a 'name=value' pair. + * s2 is a 'name=value' pair. + * If the names match, return the value of s2, else NULL. + */ +static char *envmatch(char *s1, char *s2) +{ + if (s1 == NULL || s2 == NULL) + return NULL; + + while (*s1 == *s2++) + if (*s1++ == '=') + return s2; + if (*s1 == '\0' && *(s2 - 1) == '=') + return s2; + return NULL; +} + +/** * Search the environment for a variable. * Return the value, if found, or NULL, if not found. */ @@ -1091,25 +1108,6 @@ exit: } /* - * s1 is either a simple 'name', or a 'name=value' pair. - * s2 is a 'name=value' pair. - * If the names match, return the value of s2, else NULL. - */ - -static char *envmatch (char * s1, char * s2) -{ - if (s1 == NULL || s2 == NULL) - return NULL; - - while (*s1 == *s2++) - if (*s1++ == '=') - return s2; - if (*s1 == '\0' && *(s2 - 1) == '=') - return s2; - return NULL; -} - -/* * Prevent confusion if running from erased flash memory */ int fw_env_open(struct env_opts *opts) |