summaryrefslogtreecommitdiff
path: root/common/cmd_nvedit.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-07-29 14:42:18 +0200
committerWolfgang Denk <wd@denx.de>2011-07-30 01:37:44 +0200
commit84b5e8022ef62b68df360392a55c4fc2f2e568d7 (patch)
treed594068eabcd2dd548585430ea36f9ababe7657d /common/cmd_nvedit.c
parent7ca9296e1b5b165a2c4db49c44716764f1c7dc44 (diff)
downloadu-boot-imx-84b5e8022ef62b68df360392a55c4fc2f2e568d7.zip
u-boot-imx-84b5e8022ef62b68df360392a55c4fc2f2e568d7.tar.gz
u-boot-imx-84b5e8022ef62b68df360392a55c4fc2f2e568d7.tar.bz2
Constify getenv(), setenv() and hash code functions
This is needed to get rid of build warnings like main.c:311: warning: passing argument 2 of 'setenv' discards qualifiers from pointer target type which result from commit 09c2e90 "unify version_string". Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Diffstat (limited to 'common/cmd_nvedit.c')
-rw-r--r--common/cmd_nvedit.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index b2c88ba..e8b116d 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -367,13 +367,14 @@ int _do_env_set (int flag, int argc, char * const argv[])
return 0;
}
-int setenv(char *varname, char *varvalue)
+int setenv(const char *varname, const char *varvalue)
{
- char * const argv[4] = { "setenv", varname, varvalue, NULL };
+ const char * const argv[4] = { "setenv", varname, varvalue, NULL };
+
if ((varvalue == NULL) || (varvalue[0] == '\0'))
- return _do_env_set(0, 2, argv);
+ return _do_env_set(0, 2, (char * const *)argv);
else
- return _do_env_set(0, 3, argv);
+ return _do_env_set(0, 3, (char * const *)argv);
}
int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
@@ -482,7 +483,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* return address of storage for that variable,
* or NULL if not found
*/
-char *getenv(char *name)
+char *getenv(const char *name)
{
if (gd->flags & GD_FLG_ENV_READY) { /* after import into hashtable */
ENTRY e, *ep;
@@ -507,7 +508,7 @@ char *getenv(char *name)
/*
* Look up variable from environment for restricted C runtime env.
*/
-int getenv_f(char *name, char *buf, unsigned len)
+int getenv_f(const char *name, char *buf, unsigned len)
{
int i, nxt;