Skip to content

Commit

Permalink
checkout_merged(): squelch false warning from some gcc
Browse files Browse the repository at this point in the history
gcc 4.6.2 (there may be others) does not realize that the variable "mode"
can never be used uninitialized in this function and issues a false warning
under -Wuninitialized option.

Squelch it with an unnecessary initialization; it is not like a single
assignment matters to the performance in this codepath that writes out
to the filesystem with checkout_entry() anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Dec 15, 2011
1 parent 3d0b051 commit 335c6e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static int checkout_merged(int pos, struct checkout *state)
unsigned char sha1[20];
mmbuffer_t result_buf;
unsigned char threeway[3][20];
unsigned mode;
unsigned mode = 0;

memset(threeway, 0, sizeof(threeway));
while (pos < active_nr) {
Expand Down

0 comments on commit 335c6e4

Please sign in to comment.