From: Sebastian Schuberth <sschuberth@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, mschub@elegosoft.com
Subject: Re: [PATCH] inet_ntop.c: Work around GCC 4.6's detection of uninitialized variables
Date: Tue, 18 Oct 2011 20:12:40 +0200 [thread overview]
Message-ID: <4E9DC198.9040108@gmail.com> (raw)
In-Reply-To: <7vehyagq82.fsf@alter.siamese.dyndns.org>
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>
---
compat/inet_ntop.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/compat/inet_ntop.c b/compat/inet_ntop.c
index ea249c6..9e9f6fb 100644
--- a/compat/inet_ntop.c
+++ b/compat/inet_ntop.c
@@ -98,7 +98,8 @@ 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;
- cur.base = -1;
+ best.len = 0;
+ cur = best;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
if (words[i] == 0) {
if (cur.base == -1)
--
1.7.7.msysgit.1
prev parent reply other threads:[~2011-10-18 18:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-18 16:25 [PATCH] inet_ntop.c: Work around GCC 4.6's detection of uninitialized variables Sebastian Schuberth
2011-10-18 17:32 ` Junio C Hamano
2011-10-18 18:12 ` Sebastian Schuberth [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E9DC198.9040108@gmail.com \
--to=sschuberth@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mschub@elegosoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.