env: Move envmatch() to env.h

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>
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 4f3edab..751b77d 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -709,7 +709,7 @@
 				return -1;
 		}
 
-		val = envmatch((uchar *)name, i);
+		val = env_match((uchar *)name, i);
 		if (val < 0)
 			continue;
 
@@ -785,15 +785,7 @@
 #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;
diff --git a/examples/api/glue.c b/examples/api/glue.c
index 9c8ed8d..4086616 100644
--- a/examples/api/glue.c
+++ b/examples/api/glue.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <linux/types.h>
 #include <api_public.h>
 
@@ -365,7 +366,7 @@
 
 	/*
 	 * 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))
diff --git a/include/common.h b/include/common.h
index cb6b584..26ec18d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -145,9 +145,6 @@
 /* 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
  *
diff --git a/include/env.h b/include/env.h
index 7298096..bf34ac3 100644
--- a/include/env.h
+++ b/include/env.h
@@ -40,6 +40,17 @@
 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)
  *
  * This function is called from env_get() if the environment has not been