[Bug 641] udhcpd: using preprocessor #if for WRITE_LEASES_EARLY
bugzilla at busybox.net
bugzilla at busybox.net
Thu Oct 1 23:25:13 UTC 2009
https://bugs.busybox.net/show_bug.cgi?id=641
--- Comment #1 from Denys Vlasenko <vda.linux at googlemail.com> 2009-10-01 23:25:12 UTC ---
Previous maintainer is heavily in favor for if(ENABLExxx). It does not look as
bad as #if forest, and lets compiler check syntax inside if's.
I use both forms. I slightly prefer if(ENABLExxx) since if you have many #if
ENABLExxx, it starts to be unmanageable. Look at networking/httpd.c, for
example:
# grep '^# *if' httpd.c | wc -l
70
#if ENABLE_FEATURE_HTTPD_CGI
static const char request_HEAD[] ALIGN1 = "HEAD";
const char *prequest;
char *cookie = NULL;
char *content_type = NULL;
unsigned long length = 0;
#elif ENABLE_FEATURE_HTTPD_PROXY
#define prequest request_GET
unsigned long length = 0;
#endif
#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
smallint authorized = -1;
#endif
smallint ip_allowed;
char http_major_version;
#if ENABLE_FEATURE_HTTPD_PROXY
char http_minor_version;
char *header_buf = header_buf; /* for gcc */
char *header_ptr = header_ptr;
Htaccess_Proxy *proxy_entry;
#endif
/* Allocation of iobuf is postponed until now
* (IOW, server process doesn't need to waste 8k) */
iobuf = xmalloc(IOBUF_SIZE);
rmt_ip = 0;
if (fromAddr->u.sa.sa_family == AF_INET) {
rmt_ip = ntohl(fromAddr->u.sin.sin_addr.s_addr);
}
#if ENABLE_FEATURE_IPV6
if (fromAddr->u.sa.sa_family == AF_INET6
&& fromAddr->u.sin6.sin6_addr.s6_addr32[0] == 0
&& fromAddr->u.sin6.sin6_addr.s6_addr32[1] == 0
&& ntohl(fromAddr->u.sin6.sin6_addr.s6_addr32[2]) == 0xffff)
rmt_ip = ntohl(fromAddr->u.sin6.sin6_addr.s6_addr32[3]);
#endif
O M G...
--
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the busybox-cvs
mailing list