]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
env: migrate env_get_default to call env_get_default_into
authorQuentin Schulz <quentin.schulz@theobroma-systems.com>
Wed, 17 Jan 2024 17:59:12 +0000 (18:59 +0100)
committerKever Yang <kever.yang@rock-chips.com>
Fri, 19 Jan 2024 02:57:36 +0000 (10:57 +0800)
Since both functions share a similar goal and env_get_default_into can
do what env_get_default wants to do with specific arguments, let's make
env_get_default call env_get_default_into so as to avoid code
duplication.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
env/common.c

index ebcb10854d896727ce94ccacc654c0acafbe90a2..beebbd163bfb4eed223793102bb9af415d7bf3b5 100644 (file)
@@ -351,9 +351,11 @@ bool env_get_autostart(void)
  */
 char *env_get_default(const char *name)
 {
-       if (env_get_from_linear(default_environment, name,
-                               (char *)(gd->env_buf),
-                               sizeof(gd->env_buf)) >= 0)
+       int ret;
+
+       ret = env_get_default_into(name, (char *)(gd->env_buf),
+                                  sizeof(gd->env_buf));
+       if (ret >= 0)
                return (char *)(gd->env_buf);
 
        return NULL;