From: Roy Marples Date: Wed, 9 Jul 2008 23:26:36 +0000 (+0000) Subject: Save a few bytes by avoiding memset. X-Git-Tag: v4.0.2~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f5f8e223833e1d13d157d465d3626ea6a4bba67c;p=thirdparty%2Fdhcpcd.git Save a few bytes by avoiding memset. --- diff --git a/net.c b/net.c index e6ac96aa..2243051a 100644 --- 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);