env: Move envmatch() to env.h
authorSimon Glass <sjg@chromium.org>
Thu, 1 Aug 2019 15:46:45 +0000 (09:46 -0600)
committerTom Rini <trini@konsulko.com>
Sun, 11 Aug 2019 20:43:41 +0000 (16:43 -0400)
Move envmatch() over to the new header file. Also rename it to env_match()
to better line up with other functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
cmd/nvedit.c
examples/api/glue.c
include/common.h
include/env.h

index 4f3edab8b9d0e952a74476e2f2320d38644dc33b..751b77d0e986ae918438b1e5c33f54c8ae75ef34 100644 (file)
@@ -709,7 +709,7 @@ int env_get_f(const char *name, char *buf, unsigned len)
                                return -1;
                }
 
-               val = envmatch((uchar *)name, i);
+               val = env_match((uchar *)name, i);
                if (val < 0)
                        continue;
 
@@ -785,15 +785,7 @@ U_BOOT_CMD(
 #endif
 #endif /* CONFIG_SPL_BUILD */
 
-
-/*
- * Match a name / name=value pair
- *
- * s1 is either a simple 'name', or a 'name=value' pair.
- * i2 is the environment index for a 'name2=value2' pair.
- * If the names match, return the index for the value2, else -1.
- */
-int envmatch(uchar *s1, int i2)
+int env_match(uchar *s1, int i2)
 {
        if (s1 == NULL)
                return -1;
index 9c8ed8d11cf812a788a206a225e6faf4b1c3b103..4086616a94bcd4425d2bb8b6ea1352eb9f652410 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <linux/types.h>
 #include <api_public.h>
 
@@ -365,7 +366,7 @@ const char * ub_env_enum(const char *last)
 
        /*
         * It's OK to pass only the name piece as last (and not the whole
-        * 'name=val' string), since the API_ENUM_ENV call uses envmatch()
+        * 'name=val' string), since the API_ENUM_ENV call uses env_match()
         * internally, which handles such case
         */
        if (!syscall(API_ENV_ENUM, NULL, last, &env))
index cb6b584b7090b4ba5120ee1ea07aa824148a0e3a..26ec18ded4700b95651da44a1880a4876803be25 100644 (file)
@@ -145,9 +145,6 @@ int do_fat_fsload(cmd_tbl_t *, int, int, char * const []);
 /* common/cmd_ext2.c */
 int do_ext2load(cmd_tbl_t *, int, int, char * const []);
 
-/* common/cmd_nvedit.c */
-int    envmatch     (uchar *, int);
-
 /**
  * env_get() - Look up the value of an environment variable
  *
index 72980962bf7199cba48d2ec2a9ab2ae8fad586bb..bf34ac3f8620c9a9174ee3f015dced0ebbb0deff 100644 (file)
@@ -39,6 +39,17 @@ 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_f() - Look up the value of an environment variable (early)
  *