diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-01-28 09:48:48 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-01-30 11:54:01 +0800 |
commit | d6b11766acb4457457419a84f460a3ce7a8f4693 (patch) | |
tree | 61b2db757b888c772018ad77e4bab1c894ba60ca /discover/grub2 | |
parent | e61e64c785de0809fb69cd160e8317f2de25793e (diff) | |
download | talos-petitboot-d6b11766acb4457457419a84f460a3ce7a8f4693.tar.gz talos-petitboot-d6b11766acb4457457419a84f460a3ce7a8f4693.zip |
discover/grub2: Use script_env_set when initialising the environment
No need to duplicate the environment-adding code in init_env, as we can
just use script_env_set.
Since script_env_set does its own talloc, we don't need to talloc our
strings here either.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2')
-rw-r--r-- | discover/grub2/script.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/discover/grub2/script.c b/discover/grub2/script.c index aeb5978..c4f58d9 100644 --- a/discover/grub2/script.c +++ b/discover/grub2/script.c @@ -432,13 +432,9 @@ static void init_env(struct grub2_script *script) sep - script->filename); } - env->name = talloc_strdup(env, "prefix"); + script_env_set(script, "prefix", prefix ? : default_prefix); if (prefix) - env->value = prefix; - else - env->value = talloc_strdup(env, default_prefix); - - list_add(&script->environment, &env->list); + talloc_free(prefix); } void script_register_function(struct grub2_script *script, |