git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Blake Ramsdell <blaker@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fixed a gcc 4.0.1 complaint about an uninitialized variable
Date: Thu, 01 Nov 2007 22:37:47 -0700	[thread overview]
Message-ID: <7v8x5h6wd0.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1193971102-61907-2-git-send-email-blaker@gmail.com> (Blake Ramsdell's message of "Thu, 1 Nov 2007 19:38:22 -0700")

Blake Ramsdell <blaker@gmail.com> writes:

> diff --git a/transport.c b/transport.c
> index 400af71..cac1870 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -107,7 +107,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
>  		return;
>  
>  	for (;;) {
> -		int cmp, len;
> +		int cmp = 0, len;

Yeah, if you follow the logic, it is clear that the variable is
never used while unset, but gcc is not careful enough to see it.

It is customary to use

	int cmp = cmp;

for something like this.  There are already other instances of
such phony initializations in the code elsewhere.

  reply	other threads:[~2007-11-02  5:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-02  2:38 [PATCH] Mac OS X 10.5 does not require the OLD_ICONV flag set Blake Ramsdell
2007-11-02  2:38 ` [PATCH] Fixed a gcc 4.0.1 complaint about an uninitialized variable Blake Ramsdell
2007-11-02  5:37   ` Junio C Hamano [this message]
2007-11-02  9:03 ` [PATCH] Mac OS X 10.5 does not require the OLD_ICONV flag set Junio C Hamano
2007-11-02  9:20   ` Blake Ramsdell
2007-11-02  9:30   ` Mike Hommey
2007-11-02  9:39     ` Benoit SIGOURE
2007-11-02  9:45       ` Mike Hommey
2007-11-02 10:19   ` David Symonds
2007-11-02 10:33     ` Junio C Hamano
2007-11-02 11:23       ` David Symonds
2007-11-02 20:03         ` Blake Ramsdell
2007-11-03  0:00           ` [PATCH] Removed OLD_ICONV in favor of checking _LIBICONV_VERSION directly Blake Ramsdell
2007-11-03  0:07             ` Junio C Hamano
2007-11-03  0:21               ` Blake Ramsdell

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=7v8x5h6wd0.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=blaker@gmail.com \
    --cc=git@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).