summaryrefslogtreecommitdiff
path: root/compat/inet_ntop.c
diff options
context:
space:
mode:
authorSebastian Schuberth <sschuberth@gmail.com>2011-10-18 18:25:50 +0200
committerJunio C Hamano <gitster@pobox.com>2011-10-18 10:34:07 -0700
commit185528a859170a659ae8359d13540211775e3056 (patch)
tree77cd21ec4b3e0d5a4996a334bff1f612f46de495 /compat/inet_ntop.c
parentbb34c5aabe9f8d86a40d5ab8518fc78602264179 (diff)
downloadgit-185528a859170a659ae8359d13540211775e3056.tar.gz
inet_ntop.c: Work around GCC 4.6's detection of uninitialized variablesss/inet-ntop
GCC 4.6 claims that error: 'best.len' may be used uninitialized in this function so silence that warning which is treated as an error by also initializing the "len" members of the struct. Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/inet_ntop.c')
-rw-r--r--compat/inet_ntop.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
index ea249c6ac6..60b5a1d0f8 100644
--- a/compat/inet_ntop.c
+++ b/compat/inet_ntop.c
@@ -98,7 +98,9 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
for (i = 0; i < NS_IN6ADDRSZ; i++)
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
best.base = -1;
+ best.len = 0;
cur.base = -1;
+ cur.len = 0;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
if (words[i] == 0) {
if (cur.base == -1)