Skip to content

Commit

Permalink
cat-file: Fix an gcc -Wuninitialized warning
Browse files Browse the repository at this point in the history
After commit cbfd5e1 ("drop some obsolete "x = x" compiler warning
hacks", 21-03-2013) removed a gcc specific hack, older versions of
gcc now issue an "'contents' might be used uninitialized" warning.
In order to suppress the warning, we simply initialize the variable
to NULL in it's declaration.

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 gitster committed Mar 30, 2013
1 parent 0a34594 commit 803a777
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/cat-file.c
Expand Up @@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
unsigned char sha1[20];
enum object_type type = 0;
unsigned long size;
void *contents;
void *contents = NULL;

if (!obj_name)
return 1;
Expand Down

0 comments on commit 803a777

Please sign in to comment.