Skip to content

Commit 185528a

Browse files
sschuberthgitster
authored andcommitted
inet_ntop.c: Work around GCC 4.6's detection of uninitialized variables
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bb34c5a commit 185528a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compat/inet_ntop.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ inet_ntop6(const u_char *src, char *dst, size_t size)
9898
for (i = 0; i < NS_IN6ADDRSZ; i++)
9999
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
100100
best.base = -1;
101+
best.len = 0;
101102
cur.base = -1;
103+
cur.len = 0;
102104
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
103105
if (words[i] == 0) {
104106
if (cur.base == -1)

0 commit comments

Comments
 (0)