]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add alternative building method to save around 500 bytes.
authorRoy Marples <roy@marples.name>
Mon, 24 Mar 2008 20:09:30 +0000 (20:09 +0000)
committerRoy Marples <roy@marples.name>
Mon, 24 Mar 2008 20:09:30 +0000 (20:09 +0000)
dhcp.h
dhcpcd.c
if.c
logger.c
mk/prog.mk

diff --git a/dhcp.h b/dhcp.h
index e2c910c0cd3e0a5d0db5998c9d8435a8d67ca420..dbd57287b54b1319282e70d5127e9083d093dbd3 100644 (file)
--- a/dhcp.h
+++ b/dhcp.h
@@ -37,7 +37,9 @@
 #include <netinet/in_systm.h>
 #include <netinet/in.h>
 #include <netinet/ip.h>
+#define __FAVOR_BSD /* Nasty hack so we can use BSD semantics for UDP */
 #include <netinet/udp.h>
+#undef __FAVOUR_BSD
 #include <stdint.h>
 
 #include "dhcpcd.h"
index 233721992cace79759c47575b80aedd50b4c419c..56865860e86289c1be2d59e0a6d12714531f2fac 100644 (file)
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -210,12 +210,12 @@ main(int argc, char **argv)
                case 'd':
                        debug++;
                        switch (debug) {
-                               case 1:
-                                       setloglevel(LOG_DEBUG);
-                                       break;
-                               case 2:
-                                       options->daemonise = false;
-                                       break;
+                       case 1:
+                               setloglevel(LOG_DEBUG);
+                               break;
+                       case 2:
+                               options->daemonise = false;
+                               break;
                        }
                        break;
 #ifdef THERE_IS_NO_FORK
@@ -224,7 +224,7 @@ main(int argc, char **argv)
                        close_fds();
                        break;
                case 'g':
-                       dhcpcd_skiproutes = xstrdup (optarg);
+                       dhcpcd_skiproutes = xstrdup(optarg);
                        break;
 #endif
                case 'h':
diff --git a/if.c b/if.c
index 462afbec2c9c2bacc262c9045e6a8ce8c6446b09..fd4eaeff319b818b3182c144cb6b109a04e80e2d 100644 (file)
--- a/if.c
+++ b/if.c
@@ -488,6 +488,7 @@ log_route(struct in_addr destination, struct in_addr netmask,
        free(dstd);
 }
 
+
 int
 add_address(const char *ifname, struct in_addr address,
            struct in_addr netmask, struct in_addr broadcast)
index 6e9764038cf4e3961fc06cb0d3f970b65eef0eeb..5e0bdb42fa55f40ebf0132fbf29cd79918af84c4 100644 (file)
--- a/logger.c
+++ b/logger.c
@@ -25,7 +25,9 @@
  * SUCH DAMAGE.
  */
 
-#define SYSLOG_NAMES
+#ifndef SYSLOG_NAMES
+# define SYSLOG_NAMES
+#endif
 
 #include <ctype.h>
 #include <stdarg.h>
index 6161bb550958edd8e78806a6f101fc2d7a93fa76..85d544a906f5408d55c3caedfc14621abab2fcd7 100644 (file)
@@ -17,6 +17,14 @@ all: ${PROG} ${MAN}
 ${PROG}: ${SCRIPTS} ${OBJS}
        ${CC} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
 
+# We could save about 500 bytes by building it like this
+# instead of the more traditional method above
+#${PROG}: ${SRCS}
+#      echo "" > _${PROG}.c
+#      for src in ${SRCS}; do echo "#include \"$$src\"" >> _${PROG}.c; done
+#      ${CC} ${CFLAGS} -DSYSLOG_NAMES -c _${PROG}.c -o _${PROG}.o
+#      ${CC} ${LDFLAGS} -o $@ _${PROG}.o ${LDADD}
+
 _proginstall: ${PROG}
        ${INSTALL} -d ${DESTDIR}${BINDIR}
        ${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}
@@ -28,7 +36,7 @@ include ${MK}/dist.mk
 install: _proginstall maninstall
 
 clean:
-       rm -f ${OBJS} ${PROG} ${CLEANFILES}
+       rm -f ${OBJS} ${PROG} _${PROG}.c _${PROG}.o ${CLEANFILES}
 
 LINTFLAGS?=    -hx
 LINTFLAGS+=    -X 159,247,352