git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 11/14] cat-file.c: Initialise variable to suppress msvc warning

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 4, 2010, 19:10 UTC
Message-ID
<4CFA920D.2020303@ramsay1.demon.co.uk>

The msvc compiler thinks that a variable could be used while uninitialised and issues the following warning:

    ...\git\builtin\cat-file.c(171) : warning C4700: uninitialized \
        local variable 'contents' used

In order to suppress the warning, we simply initialise the contents pointer variable to NULL.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 builtin/cat-file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 94632db..472f3ad 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -168,7 +168,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 = contents;
+	void *contents = NULL;
 
 	if (!obj_name)
 	   return 1;
-- 
1.7.3
Message 1 of 1 in “cat-file.c: Initialise variable to suppress msvc warning”
  1. 11/14 cat-file.c: Initialise variable to suppress msvc warningRamsay Jones, Dec 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.