aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2009-03-31 18:23:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-01 11:59:16 -0400
commitdc71768742b39bca298e9ca6c91e575cd4b140e6 (patch)
tree366c9c3890d791b45987cbf8279a5bf8323362cd
parent792dd4fc317e1f94a6af111a0979c1c0d8c14453 (diff)
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>
-rw-r--r--arch/um/kernel/Makefile6
-rw-r--r--arch/um/kernel/config.c.in8
2 files changed, 9 insertions, 5 deletions
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 499e5e95e609..388ec0a3ea9b 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -28,7 +28,7 @@ $(obj)/config.tmp: $(objtree)/.config FORCE
28 $(call if_changed,quote1) 28 $(call if_changed,quote1)
29 29
30quiet_cmd_quote1 = QUOTE $@ 30quiet_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$(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE 34$(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 36
37quiet_cmd_quote2 = QUOTE $@ 37quiet_cmd_quote2 = QUOTE $@
38 cmd_quote2 = sed -e '/CONFIG/{' \ 38 cmd_quote2 = sed -e '/CONFIG/{' \
39 -e 's/"CONFIG"\;/""/' \ 39 -e 's/"CONFIG"//' \
40 -e 'r $(obj)/config.tmp' \ 40 -e 'r $(obj)/config.tmp' \
41 -e 'a \' \ 41 -e 'a \' \
42 -e '""\;' \ 42 -e '""' \
43 -e '}' \ 43 -e '}' \
44 $< > $@ 44 $< > $@
diff --git a/arch/um/kernel/config.c.in b/arch/um/kernel/config.c.in
index c062cbfe386e..bee154d1ba75 100644
--- a/arch/um/kernel/config.c.in
+++ b/arch/um/kernel/config.c.in
@@ -7,11 +7,15 @@
7#include <stdlib.h> 7#include <stdlib.h>
8#include "init.h" 8#include "init.h"
9 9
10static __initdata char *config = "CONFIG"; 10static __initdata const char *config[] = {
11"CONFIG"
12};
11 13
12static int __init print_config(char *line, int *add) 14static 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 exit(0); 19 exit(0);
16} 20}
17 21