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

uml: don't use a too long string literal

uml uses a concatenated string literal to store the contents of .config,
but .config file content is varaible, it can be very long.

Use an array of string literals instead.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

WANG Cong and committed by
Linus Torvalds
dc717687 792dd4fc

+9 -5
+3 -3
arch/um/kernel/Makefile
··· 28 28 $(call if_changed,quote1) 29 29 30 30 quiet_cmd_quote1 = QUOTE $@ 31 - cmd_quote1 = sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' \ 31 + cmd_quote1 = sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n",/' \ 32 32 $< > $@ 33 33 34 34 $(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE ··· 36 36 37 37 quiet_cmd_quote2 = QUOTE $@ 38 38 cmd_quote2 = sed -e '/CONFIG/{' \ 39 - -e 's/"CONFIG"\;/""/' \ 39 + -e 's/"CONFIG"//' \ 40 40 -e 'r $(obj)/config.tmp' \ 41 41 -e 'a \' \ 42 - -e '""\;' \ 42 + -e '""' \ 43 43 -e '}' \ 44 44 $< > $@
+6 -2
arch/um/kernel/config.c.in
··· 7 7 #include <stdlib.h> 8 8 #include "init.h" 9 9 10 - static __initdata char *config = "CONFIG"; 10 + static __initdata const char *config[] = { 11 + "CONFIG" 12 + }; 11 13 12 14 static int __init print_config(char *line, int *add) 13 15 { 14 - printf("%s", config); 16 + int i; 17 + for (i = 0; i < sizeof(config)/sizeof(config[0]); i++) 18 + printf("%s", config[i]); 15 19 exit(0); 16 20 } 17 21