summaryrefslogtreecommitdiff
path: root/cmd/nvedit.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-08-03 12:22:12 -0600
committerTom Rini <trini@konsulko.com>2017-08-16 08:30:24 -0400
commit00caae6d47645e68d6e5277aceb69592b49381a6 (patch)
treec361aa0cea3093b93c1118266fe9e2b44ac6e453 /cmd/nvedit.c
parentfd1e959e91d2b0b2e853d09dd9167dfff18a616c (diff)
downloadu-boot-00caae6d47645e68d6e5277aceb69592b49381a6.tar.gz
env: Rename getenv/_f() to env_get()
We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/nvedit.c')
-rw-r--r--cmd/nvedit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index a649004850..0468a4b7e9 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -333,7 +333,7 @@ ulong getenv_hex(const char *varname, ulong default_val)
ulong value;
char *endp;
- s = getenv(varname);
+ s = env_get(varname);
if (s)
value = simple_strtoul(s, &endp, 16);
if (!s || endp == s)
@@ -594,7 +594,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
return 1;
/* Set read buffer to initial value or empty sting */
- init_val = getenv(argv[1]);
+ init_val = env_get(argv[1]);
if (init_val)
snprintf(buffer, CONFIG_SYS_CBSIZE, "%s", init_val);
else
@@ -622,7 +622,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
* return address of storage for that variable,
* or NULL if not found
*/
-char *getenv(const char *name)
+char *env_get(const char *name)
{
if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
ENTRY e, *ep;
@@ -637,7 +637,7 @@ char *getenv(const char *name)
}
/* restricted capabilities before import */
- if (getenv_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
+ if (env_get_f(name, (char *)(gd->env_buf), sizeof(gd->env_buf)) > 0)
return (char *)(gd->env_buf);
return NULL;
@@ -646,7 +646,7 @@ char *getenv(const char *name)
/*
* Look up variable from environment for restricted C runtime env.
*/
-int getenv_f(const char *name, char *buf, unsigned len)
+int env_get_f(const char *name, char *buf, unsigned len)
{
int i, nxt;
@@ -693,10 +693,10 @@ int getenv_f(const char *name, char *buf, unsigned len)
ulong getenv_ulong(const char *name, int base, ulong default_val)
{
/*
- * We can use getenv() here, even before relocation, since the
+ * We can use env_get() here, even before relocation, since the
* environment variable value is an integer and thus short.
*/
- const char *str = getenv(name);
+ const char *str = env_get(name);
return str ? simple_strtoul(str, NULL, base) : default_val;
}