Commit dc717687 authored by WANG Cong's avatar WANG Cong Committed by Linus Torvalds

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: default avatarWANG Cong <xiyou.wangcong@gmail.com>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 792dd4fc
...@@ -28,7 +28,7 @@ $(obj)/config.tmp: $(objtree)/.config FORCE ...@@ -28,7 +28,7 @@ $(obj)/config.tmp: $(objtree)/.config FORCE
$(call if_changed,quote1) $(call if_changed,quote1)
quiet_cmd_quote1 = QUOTE $@ quiet_cmd_quote1 = QUOTE $@
cmd_quote1 = sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' \ cmd_quote1 = sed -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n",/' \
$< > $@ $< > $@
$(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE $(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE
...@@ -36,9 +36,9 @@ $(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE ...@@ -36,9 +36,9 @@ $(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE
quiet_cmd_quote2 = QUOTE $@ quiet_cmd_quote2 = QUOTE $@
cmd_quote2 = sed -e '/CONFIG/{' \ cmd_quote2 = sed -e '/CONFIG/{' \
-e 's/"CONFIG"\;/""/' \ -e 's/"CONFIG"//' \
-e 'r $(obj)/config.tmp' \ -e 'r $(obj)/config.tmp' \
-e 'a \' \ -e 'a \' \
-e '""\;' \ -e '""' \
-e '}' \ -e '}' \
$< > $@ $< > $@
...@@ -7,11 +7,15 @@ ...@@ -7,11 +7,15 @@
#include <stdlib.h> #include <stdlib.h>
#include "init.h" #include "init.h"
static __initdata char *config = "CONFIG"; static __initdata const char *config[] = {
"CONFIG"
};
static int __init print_config(char *line, int *add) static int __init print_config(char *line, int *add)
{ {
printf("%s", config); int i;
for (i = 0; i < sizeof(config)/sizeof(config[0]); i++)
printf("%s", config[i]);
exit(0); exit(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment