Skip to content

Commit

Permalink
notes: Initialise variable to appease gcc
Browse files Browse the repository at this point in the history
gcc version 3.4.4 thinks that the 'cmp' variable could be used
while uninitialised and complains thus:

    notes.c: In function `write_each_non_note_until':
    notes.c:719: warning: 'cmp' might be used uninitialized in \
        this function

Note that gcc versions 4.1.2 and 4.4.0 do not issue this warning.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramsay Jones authored and Junio C Hamano committed Jun 28, 2010
1 parent bbb1b8a commit 89fe121
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion notes.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ static int write_each_non_note_until(const char *note_path,
struct write_each_note_data *d)
{
struct non_note *n = d->next_non_note;
int cmp, ret;
int cmp = 0, ret;
while (n && (!note_path || (cmp = strcmp(n->path, note_path)) <= 0)) {
if (note_path && cmp == 0)
; /* do nothing, prefer note to non-note */
Expand Down

0 comments on commit 89fe121

Please sign in to comment.