OSDN Git Service

inet_ntop4: avoid inline initialization
authorMike Frysinger <vapier@gentoo.org>
Thu, 22 Oct 2009 04:41:29 +0000 (00:41 -0400)
committerAustin Foxley <austinf@cetoncorp.com>
Mon, 9 Nov 2009 23:33:44 +0000 (15:33 -0800)
We only need to set the first byte to 0, but gcc likes to zero out the
rest of the string with memset() when using this initialization style.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
libc/inet/ntop.c

index 57a0b8c..fa733e0 100644 (file)
 static const char *
 inet_ntop4(const u_char *src, char *dst, size_t size)
 {
-       char tmp[sizeof ("255.255.255.255") + 1] = "\0";
+       char tmp[sizeof ("255.255.255.255") + 1];
        int octet;
        int i;
 
+       tmp[0] = '\0';
+
        i = 0;
        for (octet = 0; octet <= 3; octet++) {