Skip to content

Commit

Permalink
inet_ntop.c: Work around GCC 4.6's detection of uninitialized variables
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sschuberth authored and gitster committed Oct 18, 2011
1 parent bb34c5a commit 185528a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compat/inet_ntop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 185528a

Please sign in to comment.