]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Save a few bytes by avoiding memset.
authorRoy Marples <roy@marples.name>
Wed, 9 Jul 2008 23:26:36 +0000 (23:26 +0000)
committerRoy Marples <roy@marples.name>
Wed, 9 Jul 2008 23:26:36 +0000 (23:26 +0000)
net.c

diff --git a/net.c b/net.c
index e6ac96aa3cebf8469ea795e0360b461d3136f0e2..2243051a6f0fa8872a51c3b71102d7644482fced 100644 (file)
--- a/net.c
+++ b/net.c
@@ -618,7 +618,7 @@ int
 send_arp(const struct interface *iface, int op, in_addr_t sip, in_addr_t tip)
 {
        struct arphdr *arp;
-       size_t arpsize, l;
+       size_t arpsize;
        uint8_t *p;
        int retval;
 
@@ -645,9 +645,8 @@ send_arp(const struct interface *iface, int op, in_addr_t sip, in_addr_t tip)
        memcpy(p, &tip, sizeof(tip));
        p += sizeof(tip);
        /* Zero pad if needed */
-       l = p - (uint8_t *)arp;
-       if (l < arpsize)
-               memset(p, 0, arpsize - l);
+       while (p < (uint8_t *)arp + arpsize)
+               *p++ = '\0';
 
        retval = send_raw_packet(iface, ETHERTYPE_ARP, arp, arpsize);
        free(arp);