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

kconfig: refactor listnewconfig code

We can reuse __print_symbol() helper to print symbols for listnewconfig.
Only the difference is the format for "n" symbols.

This prints "CONFIG_FOO=n" instead of "# CONFIG_FOO is not set".

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+8 -12
+2 -12
scripts/kconfig/conf.c
··· 646 646 647 647 switch (input_mode) { 648 648 case listnewconfig: 649 - if (sym->name) { 650 - const char *val = sym_get_string_value(sym); 651 - char *escaped = NULL; 652 - 653 - if (sym->type == S_STRING) { 654 - escaped = sym_escape_string_value(val); 655 - val = escaped; 656 - } 657 - 658 - printf("%s%s=%s\n", CONFIG_, sym->name, val); 659 - free(escaped); 660 - } 649 + if (sym->name) 650 + print_symbol_for_listconfig(sym); 661 651 break; 662 652 case helpnewconfig: 663 653 printf("-----\n");
+5
scripts/kconfig/confdata.c
··· 667 667 __print_symbol(fp, sym, OUTPUT_N_NONE, true); 668 668 } 669 669 670 + void print_symbol_for_listconfig(struct symbol *sym) 671 + { 672 + __print_symbol(stdout, sym, OUTPUT_N, true); 673 + } 674 + 670 675 static void print_symbol_for_c(FILE *fp, struct symbol *sym) 671 676 { 672 677 const char *val;
+1
scripts/kconfig/lkc_proto.h
··· 19 19 struct symbol * sym_lookup(const char *name, int flags); 20 20 struct symbol * sym_find(const char *name); 21 21 char *sym_escape_string_value(const char *in); 22 + void print_symbol_for_listconfig(struct symbol *sym); 22 23 struct symbol ** sym_re_search(const char *pattern); 23 24 const char * sym_type_name(enum symbol_type type); 24 25 void sym_calc_value(struct symbol *sym);