diff options
author | Joakim Tjernlund | 2008-04-14 23:01:50 +0200 |
---|---|---|
committer | Wolfgang Denk | 2008-04-17 13:20:14 -0700 |
commit | c0559be371b2a64b1a817088c3308688e2182f93 (patch) | |
tree | 29a1cf26364ab3e96e76cfa817171af1e624430d /common/env_common.c | |
parent | 3dfd4aab929cccddb63d9ea509967861e1333b52 (diff) |
Change env_get_char from a global function ptr to a function.
This avoids an early global data reference.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Diffstat (limited to 'common/env_common.c')
-rw-r--r-- | common/env_common.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/common/env_common.c b/common/env_common.c index a49481244e2..f366fdbeb23 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -50,7 +50,6 @@ extern void env_relocate_spec (void); extern uchar env_get_char_spec(int); static uchar env_get_char_init (int index); -uchar (*env_get_char)(int) = env_get_char_init; /************************************************************************ * Default settings to be used when no valid environment is found @@ -182,6 +181,19 @@ uchar env_get_char_memory (int index) } #endif +uchar env_get_char (int index) +{ + uchar c; + + /* if relocated to RAM */ + if (gd->flags & GD_FLG_RELOC) + c = env_get_char_memory(index); + else + c = env_get_char_init(index); + + return (c); +} + uchar *env_get_addr (int index) { if (gd->env_valid) { @@ -215,11 +227,6 @@ void env_relocate (void) DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr); #endif - /* - * After relocation to RAM, we can always use the "memory" functions - */ - env_get_char = env_get_char_memory; - if (gd->env_valid == 0) { #if defined(CONFIG_GTH) || defined(CFG_ENV_IS_NOWHERE) /* Environment not changable */ puts ("Using default environment\n\n"); |