uml: don't use a too long string literal
authorWANG Cong <xiyou.wangcong@gmail.com>
Tue, 31 Mar 2009 22:23:40 +0000 (15:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 1 Apr 2009 15:59:16 +0000 (08:59 -0700)
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>
arch/um/kernel/Makefile
arch/um/kernel/config.c.in

index 499e5e95e60937c887c36a50ce91081e0de462bd..388ec0a3ea9b0f57cfffe0ad14eb411934069df5 100644 (file)
@@ -28,7 +28,7 @@ $(obj)/config.tmp: $(objtree)/.config FORCE
        $(call if_changed,quote1)
 
 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
@@ -36,9 +36,9 @@ $(obj)/config.c: $(src)/config.c.in $(obj)/config.tmp FORCE
 
 quiet_cmd_quote2 = QUOTE   $@
       cmd_quote2 = sed -e '/CONFIG/{'          \
-                 -e 's/"CONFIG"\;/""/'        \
+                 -e 's/"CONFIG"//'            \
                  -e 'r $(obj)/config.tmp'     \
                  -e 'a \'                     \
-                 -e '""\;'                    \
+                 -e '""'                      \
                  -e '}'                       \
                  $< > $@
index c062cbfe386e22a153ab43833bffa96932eac874..bee154d1ba75036434b81977424986eb470f4dec 100644 (file)
@@ -7,11 +7,15 @@
 #include <stdlib.h>
 #include "init.h"
 
-static __initdata char *config = "CONFIG";
+static __initdata const char *config[] = {
+"CONFIG"
+};
 
 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);
 }