diff options
author | Rob Landley <rob@landley.net> | 2005-07-27 10:55:36 +0400 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2005-07-27 10:55:36 +0400 |
commit | 193c8c73834b701f93c421fc88a2ecb715fd6fe5 (patch) | |
tree | 8467a696b1990e665391d4fcde21c8f176f27cd1 /networking/ifconfig.c | |
parent | 77804ce53d2a83d89e272a20763f2e6f5fc25d8c (diff) |
#ifdef reduction infrastructure, based on an argument between Shaun Jackman,
Rob Landley, and others.
Currently CONFIG options are defined or undefined, so we chop out code with
#ifdefs, ala:
#ifdef CONFIG_THING
stuff();
#endif
This creates a new header file, bb_config.h, which sets the CONFIG entry to 1
or 0, and lets us do:
if(CONFIG_THING) stuff();
And let the compiler do dead code elimination to get rid of it. (Note: #ifdef
will still work because for the 1 case it's a static const int, not a #define.)
Diffstat (limited to 'networking/ifconfig.c')
-rw-r--r-- | networking/ifconfig.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index fc7798f2d..1b43a0825 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -37,6 +37,7 @@ #include <string.h> /* strcmp and friends */ #include <ctype.h> /* isdigit and friends */ #include <stddef.h> /* offsetof */ +#include <unistd.h> #include <netdb.h> #include <sys/ioctl.h> #include <net/if.h> @@ -558,6 +559,7 @@ int ifconfig_main(int argc, char **argv) continue; } /* end of while-loop */ + if (CONFIG_FEATURE_CLEAN_UP) close(sockfd); return goterr; } |