Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+18 -12
+2 -6
scripts/kconfig/confdata.c
··· 994 994 return -1; 995 995 } 996 996 997 + fprintf(out, "autoconfig := %s\n", autoconf_name); 998 + 997 999 fputs(str_get(&autoconf_cmd), out); 998 - 999 - fprintf(out, "\n%s: $(deps_config)\n\n", autoconf_name); 1000 - 1001 - env_write_dep(out, autoconf_name); 1002 - 1003 - fprintf(out, "\n$(deps_config): ;\n"); 1004 1000 1005 1001 fflush(out); 1006 1002 ret = ferror(out); /* error check for all fprintf() calls */
+1 -1
scripts/kconfig/lkc_proto.h
··· 46 46 VAR_RECURSIVE, 47 47 VAR_APPEND, 48 48 }; 49 - void env_write_dep(FILE *f, const char *auto_conf_name); 49 + void env_write_dep(struct gstr *gs); 50 50 void variable_add(const char *name, const char *value, 51 51 enum variable_flavor flavor); 52 52 void variable_all_del(void);
+8 -1
scripts/kconfig/parser.y
··· 482 482 483 483 autoconf_cmd = str_new(); 484 484 485 - str_printf(&autoconf_cmd, "deps_config := \\\n"); 485 + str_printf(&autoconf_cmd, "\ndeps_config := \\\n"); 486 486 487 487 zconf_initscan(name); 488 488 ··· 491 491 if (getenv("ZCONF_DEBUG")) 492 492 yydebug = 1; 493 493 yyparse(); 494 + 495 + str_printf(&autoconf_cmd, 496 + "\n" 497 + "$(autoconfig): $(deps_config)\n" 498 + "$(deps_config): ;\n"); 499 + 500 + env_write_dep(&autoconf_cmd); 494 501 495 502 /* Variables are expanded in the parse phase. We can free them here. */ 496 503 variable_all_del();
+7 -4
scripts/kconfig/preprocess.c
··· 87 87 return xstrdup(value); 88 88 } 89 89 90 - void env_write_dep(FILE *f, const char *autoconfig_name) 90 + void env_write_dep(struct gstr *s) 91 91 { 92 92 struct env *e, *tmp; 93 93 94 94 list_for_each_entry_safe(e, tmp, &env_list, node) { 95 - fprintf(f, "ifneq \"$(%s)\" \"%s\"\n", e->name, e->value); 96 - fprintf(f, "%s: FORCE\n", autoconfig_name); 97 - fprintf(f, "endif\n"); 95 + str_printf(s, 96 + "\n" 97 + "ifneq \"$(%s)\" \"%s\"\n" 98 + "$(autoconfig): FORCE\n" 99 + "endif\n", 100 + e->name, e->value); 98 101 env_del(e); 99 102 } 100 103 }