[Bug 641] New: udhcpd: using preprocessor #if for WRITE_LEASES_EARLY

bugzilla at busybox.net bugzilla at busybox.net
Thu Oct 1 13:04:45 UTC 2009


           Summary: udhcpd: using preprocessor #if for WRITE_LEASES_EARLY
           Product: Busybox
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: jirij.jabb at gmail.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0

I've searched through the udhcpd sources (networking/udhcp/) and found only
this used as if(...), all others are #if ...

I'm not sure what style do you prefer, whether it's better to filter this on
the preprocessor level or on the compiler level (using optimizations).
I personally prefer preprocessor in this case, so

diff --git a/networking/udhcp/serverpacket.c b/networking/udhcp/serverpacket.c
index b48e415..3d5f181 100644
--- a/networking/udhcp/serverpacket.c
+++ b/networking/udhcp/serverpacket.c
@@ -254,10 +254,11 @@ int FAST_FUNC send_ACK(struct dhcp_packet *oldpacket,
uint32_t yiaddr)
                p_host_name ? (unsigned char)p_host_name[OPT_LEN - OPT_DATA] :
                /* rewrite the file with leases at every new acceptance */
-       }

        return 0;

(please pull [--rebase] from git://repo.or.cz/jirij.git, branch busybox_if)

Further search revealed a lot of if(ENABLE_FEATURE_*) conditions, some of them
with additional checks like if(ENABLE_FEATURE_SOMETHING && !ptr) - moving those
to #if could make the code look more complicated, however for plain
if(ENABLE_FEATURE_*), I'd suggest the ->preprocessor change.

What's your opinion?

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