[git commit master] inet_ntop4: avoid inline initialization

Mike Frysinger vapier at gentoo.org
Fri Apr 23 14:31:55 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=964d40c5d90598d70616fe54de934ddda39bdc2c
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

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 at gentoo.org>
Signed-off-by: Austin Foxley <austinf at cetoncorp.com>
---
 libc/inet/ntop.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c
index 57a0b8c..fa733e0 100644
--- a/libc/inet/ntop.c
+++ b/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++) {
 
-- 
1.6.3.3



More information about the uClibc-cvs mailing list