env: Change env_match() to static and remove from header
authorMarek Behún <marek.behun@nic.cz>
Sun, 17 Oct 2021 15:36:29 +0000 (17:36 +0200)
committerSimon Glass <sjg@chromium.org>
Thu, 21 Oct 2021 18:50:48 +0000 (12:50 -0600)
This function was used by other parts of U-Boot in the past when
environment was read from underlying device one character at a time.

This is not the case anymore.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/nvedit.c
include/env.h

index ddc715b..742e092 100644 (file)
@@ -706,6 +706,21 @@ char *from_env(const char *envvar)
        return ret;
 }
 
+static int env_match(uchar *s1, int i2)
+{
+       if (s1 == NULL)
+               return -1;
+
+       while (*s1 == env_get_char(i2++))
+               if (*s1++ == '=')
+                       return i2;
+
+       if (*s1 == '\0' && env_get_char(i2-1) == '=')
+               return i2;
+
+       return -1;
+}
+
 /*
  * Look up variable from environment for restricted C runtime env.
  */
@@ -816,21 +831,6 @@ static int do_env_select(struct cmd_tbl *cmdtp, int flag, int argc,
 
 #endif /* CONFIG_SPL_BUILD */
 
-int env_match(uchar *s1, int i2)
-{
-       if (s1 == NULL)
-               return -1;
-
-       while (*s1 == env_get_char(i2++))
-               if (*s1++ == '=')
-                       return i2;
-
-       if (*s1 == '\0' && env_get_char(i2-1) == '=')
-               return i2;
-
-       return -1;
-}
-
 #ifndef CONFIG_SPL_BUILD
 static int do_env_default(struct cmd_tbl *cmdtp, int flag,
                          int argc, char *const argv[])
index b1a4003..a9b2a4c 100644 (file)
@@ -91,17 +91,6 @@ int env_init(void);
 void env_relocate(void);
 
 /**
- * env_match() - Match a name / name=value pair
- *
- * This is used prior to relocation for finding envrionment variables
- *
- * @name: A simple 'name', or a 'name=value' pair.
- * @index: The environment index for a 'name2=value2' pair.
- * @return index for the value if the names match, else -1.
- */
-int env_match(unsigned char *name, int index);
-
-/**
  * env_get() - Look up the value of an environment variable
  *
  * In U-Boot proper this can be called before relocation (which is when the