]> git.ipfire.org Git - thirdparty/git.git/commitdiff
fast-import: Fix an gcc -Wuninitialized warning
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>
Tue, 26 Mar 2013 19:09:44 +0000 (19:09 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Mar 2013 06:46:55 +0000 (23:46 -0700)
Commit cbfd5e1c ("drop some obsolete "x = x" compiler warning hacks",
21-03-2013) removed a gcc hack that suppressed an "might be used
uninitialized" warning issued by older versions of gcc.

However, commit 3aa99df8 ('fast-import: clarify "inline" logic in
file_change_m', 21-03-2013) addresses an (almost) identical issue
(with very similar code), but includes additional code in it's
resolution. The solution used by this commit, unlike that used by
commit cbfd5e1c, also suppresses the -Wuninitialized warning on
older versions of gcc.

In order to suppress the warning (against the 'oe' symbol) in the
note_change_n() function, we adopt the same solution used by commit
3aa99df8.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fast-import.c

index a0c2c2ff14f471c4ffa6ff1f4ec9085562378ad1..5f539d7d8f7e087423734fb1d19e0d5e580fbe6e 100644 (file)
@@ -2465,6 +2465,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout)
                hashcpy(sha1, oe->idx.sha1);
        } else if (!prefixcmp(p, "inline ")) {
                inline_data = 1;
+               oe = NULL; /* not used with inline_data, but makes gcc happy */
                p += strlen("inline");  /* advance to space */
        } else {
                if (get_sha1_hex(p, sha1))