]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cat-file: Fix an gcc -Wuninitialized warning
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>
Tue, 26 Mar 2013 19:20:11 +0000 (19:20 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 30 Mar 2013 06:47:00 +0000 (23:47 -0700)
After commit cbfd5e1c ("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>
builtin/cat-file.c

index ad290007363120062b044ecb47cf976dbe118384..40f87b4649aa97ca1f33a02f09f5938ce5f41f74 100644 (file)
@@ -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;