Erik pointed out that in the last try at the #ifdef cleanup
authorRob Landley <rob@landley.net>
Thu, 28 Jul 2005 19:36:33 +0000 (19:36 -0000)
committerRob Landley <rob@landley.net>
Thu, 28 Jul 2005 19:36:33 +0000 (19:36 -0000)
infrastructure, the compiler isn't smart enough to replace const static
int with the constant, and allocates space for each set of them,
bloating the executable something fierce.  Oops.

So now, we #define ENABLE_XXX to 0 or 1 for each CONFIG_XXX (which
is still there so the 1000+ #ifdef/#ifndef tests don't have to be
replaced wholesale).  Changed the test instance in networking/ifconfig.c
to use this.

Makefile
networking/ifconfig.c

index 807ab50580c75b723bd9b03a57627476711451f1..33954db0500df7f354b658a5b4047dd5b47f02a5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -214,7 +214,9 @@ include/config.h: .config
 
 include/bb_config.h: include/config.h
        echo "#ifndef AUTOCONF_INCLUDED" > $@
-       sed -e 's/#undef \(.*\)/static const int \1 = 0;/' < $< >> $@
+       sed -e 's/#undef CONFIG_\(.*\)/#define ENABLE_\1 0/' \
+           -e 's/#define CONFIG_\(.*\)/#define CONFIG_\1\n#define ENABLE_\1/' \
+               < $< >> $@
        echo "#endif" >> $@
 
 finished2:
index 1b43a082571272c251e34645a21a566831e36f4c..f79fd83beb8e2ed9109f6e1b88197fc40cdfd1f6 100644 (file)
@@ -559,7 +559,7 @@ int ifconfig_main(int argc, char **argv)
                continue;
        }                                       /* end of while-loop */
 
-       if (CONFIG_FEATURE_CLEAN_UP) close(sockfd);
+       if (ENABLE_FEATURE_CLEAN_UP) close(sockfd);
        return goterr;
 }