[U-Boot] [PATCH] constify default env
Mike Frysinger
vapier at gentoo.org
Sun Apr 24 11:43:21 CEST 2011
I can't see any obvious needs for the default environment to be writable,
so make it const.
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
common/env_common.c | 4 ++--
common/env_flash.c | 2 +-
include/environment.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/env_common.c b/common/env_common.c
index c3e6388..19149b5 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -47,7 +47,7 @@ static uchar env_get_char_init (int index);
#define XMK_STR(x) #x
#define MK_STR(x) XMK_STR(x)
-uchar default_environment[] = {
+const uchar default_environment[] = {
#ifdef CONFIG_BOOTARGS
"bootargs=" CONFIG_BOOTARGS "\0"
#endif
@@ -162,7 +162,7 @@ uchar env_get_char (int index)
return (c);
}
-uchar *env_get_addr (int index)
+const uchar *env_get_addr (int index)
{
if (gd->env_valid)
return (uchar *)(gd->env_addr + index);
diff --git a/common/env_flash.c b/common/env_flash.c
index 456f2e8..50ca4ffa 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -74,7 +74,7 @@ static env_t *flash_addr_new = (env_t *)CONFIG_ENV_ADDR_REDUND;
static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1;
#endif /* CONFIG_ENV_ADDR_REDUND */
-extern uchar default_environment[];
+extern const uchar default_environment[];
uchar env_get_char_spec(int index)
diff --git a/include/environment.h b/include/environment.h
index 53d92df..e8b6e45 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -160,7 +160,7 @@ extern struct hsearch_data env_htab;
unsigned char env_get_char (int);
/* Function that returns a pointer to a value from the environment */
-unsigned char *env_get_addr(int);
+const unsigned char *env_get_addr(int);
unsigned char env_get_char_memory (int index);
/* Function that updates CRC of the enironment */
--
1.7.5.rc1
More information about the U-Boot
mailing list