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

[PATCH 13/14] transport.c: Initialise variable to suppress msvc warning

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 4, 2010, 19:11 UTC
Message-ID
<4CFA926C.70501@ramsay1.demon.co.uk>

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

    ...\git\transport.c(107) : warning C4700: uninitialized local \
        variable 'cmp' used

In order to suppress the warning, we simply initialise the variable to zero.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 transport.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/transport.c b/transport.c
index 0078660..1dca6d4 100644
--- a/transport.c
+++ b/transport.c
@@ -104,7 +104,7 @@ static void insert_packed_refs(const char *packed_refs, struct ref **list)
 		return;
 
 	for (;;) {
-		int cmp = cmp, len;
+		int cmp = 0, len;
 
 		if (!fgets(buffer, sizeof(buffer), f)) {
 			fclose(f);
-- 
1.7.3
Message 1 of 1 in “transport.c: Initialise variable to suppress msvc warning”
  1. 13/14 transport.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.