summaryrefslogtreecommitdiff
path: root/scripts/kconfig/preprocess.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-02-03 00:58:05 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2024-02-19 18:20:40 +0900
commit56e634b06fd554b819ac9c45fc77a41500861ced (patch)
treeda7da38591efbae297cd7eb9baa6d279abbf3256 /scripts/kconfig/preprocess.c
parent526396b723a38dbeed35cb9e80814084b9f56329 (diff)
kconfig: call env_write_dep() right after yyparse()
This allows preprocess.c to free up all of its resources when the parse stage is finished. It also ensures conf_write_autoconf_cmd() produces consistent results even if called multiple times for any reason. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/kconfig/preprocess.c')
-rw-r--r--scripts/kconfig/preprocess.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index d1f5bcff4b62..b9853d4a891c 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -87,14 +87,17 @@ static char *env_expand(const char *name)
return xstrdup(value);
}
-void env_write_dep(FILE *f, const char *autoconfig_name)
+void env_write_dep(struct gstr *s)
{
struct env *e, *tmp;
list_for_each_entry_safe(e, tmp, &env_list, node) {
- fprintf(f, "ifneq \"$(%s)\" \"%s\"\n", e->name, e->value);
- fprintf(f, "%s: FORCE\n", autoconfig_name);
- fprintf(f, "endif\n");
+ str_printf(s,
+ "\n"
+ "ifneq \"$(%s)\" \"%s\"\n"
+ "$(autoconfig): FORCE\n"
+ "endif\n",
+ e->name, e->value);
env_del(e);
}
}