فهرست منبع

inet_ntop4: avoid inline initialization

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>
Mike Frysinger 15 سال پیش
والد
کامیت
964d40c5d9
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      libc/inet/ntop.c

+ 3 - 1
libc/inet/ntop.c

@@ -51,10 +51,12 @@
 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++) {