diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2020-02-27 13:56:12 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-04-24 10:09:59 -0400 |
commit | 080019b86c997a9b7e13bc7b8f476fbf9a0e5f3c (patch) | |
tree | 79d730d1f93c336251fe391c7a157455f8465f9e /env | |
parent | 34284970a1736e7be35bef74e4f8e429e703c1ce (diff) | |
download | u-boot-080019b86c997a9b7e13bc7b8f476fbf9a0e5f3c.zip u-boot-080019b86c997a9b7e13bc7b8f476fbf9a0e5f3c.tar.gz u-boot-080019b86c997a9b7e13bc7b8f476fbf9a0e5f3c.tar.bz2 |
make env_entry::callback conditional on !CONFIG_SPL_BUILD
The callback member of struct env_entry is always NULL for an SPL
build. Removing it thus saves a bit of run-time memory in the
SPL (when CONFIG_SPL_ENV_SUPPORT=y) since struct env_entry is embedded
in struct env_entry_node - i.e. about 2KB for the normal case of
512+change hash table entries.
Two small fixups are needed for this, all other references to the
callback member are already under !CONFIG_SPL_BUILD: Don't initialize
.callback in set_flags() - hsearch_r doesn't use that value
anyway. And make env_callback_init() initialize ->callback to NULL for
a new entry instead of relying on an unused or deleted entry having
NULL in ->callback.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'env')
-rw-r--r-- | env/callback.c | 2 | ||||
-rw-r--r-- | env/flags.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/env/callback.c b/env/callback.c index f0904cf..4054b9e 100644 --- a/env/callback.c +++ b/env/callback.c @@ -55,6 +55,8 @@ void env_callback_init(struct env_entry *var_entry) first_call = 0; } + var_entry->callback = NULL; + /* look in the ".callbacks" var for a reference to this variable */ if (callback_list != NULL) ret = env_attr_lookup(callback_list, var_name, callback_name); diff --git a/env/flags.c b/env/flags.c index 418d6cc..b88fe7b 100644 --- a/env/flags.c +++ b/env/flags.c @@ -457,7 +457,6 @@ static int set_flags(const char *name, const char *value, void *priv) e.key = name; e.data = NULL; - e.callback = NULL; hsearch_r(e, ENV_FIND, &ep, &env_htab, 0); /* does the env variable actually exist? */ |