From: Andreas Fenkart Date: Sat, 16 Jul 2016 15:06:14 +0000 (+0200) Subject: tools/env: move envmatch further up in file to avoid forward declarations X-Git-Tag: v2016.09-rc1~36 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1b7427cd2ab6aae150559ee2edc8965fda113fdf;p=u-boot tools/env: move envmatch further up in file to avoid forward declarations forward declaration not needed when re-ordered Reviewed-by: Simon Glass Signed-off-by: Andreas Fenkart --- diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 1dad1ce547..faba9a9133 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -122,7 +122,6 @@ static unsigned char obsolete_flag = 0; #include 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. */ @@ -1090,25 +1107,6 @@ exit: return rc; } -/* - * 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 */