threads / patch / 25961

patch, 14 partsfast-import.c: Initialise variables to suppress msvc warnings

Subject: [PATCH 07/14] fast-import.c: Initialise variables to suppress msvc warnings

## tl;dr

One message between Dec 4, 2010 and Dec 4, 2010. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Ramsay Jones· Dec 4, 2010, 19:06 UTC · lore

The msvc compiler thinks that three variables could be used while uninitialised and issues the following warnings:

    ...\git\fast-import.c(2474) : warning C4700: uninitialized local \
        variable 'e' used
    ...\git\fast-import.c(2314) : warning C4700: uninitialized local \
        variable 'oe' used
    ...\git\fast-import.c(2151) : warning C4700: uninitialized local \
        variable 'oe' used

In order to suppress the warnings, we simply initialise all three of the pointer variables to NULL.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 fast-import.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Show changes to fast-import.c +3 −3
diff --git a/fast-import.c b/fast-import.c
index 8263dbe..1d7cd03 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2148,7 +2148,7 @@ static void file_change_m(struct branch *b)
 	const char *p = command_buf.buf + 2;
 	static struct strbuf uq = STRBUF_INIT;
 	const char *endp;
-	struct object_entry *oe = oe;
+	struct object_entry *oe = NULL;
 	unsigned char sha1[20];
 	uint16_t mode, inline_data = 0;
 
@@ -2311,7 +2311,7 @@ static void note_change_n(struct branch *b, unsigned char old_fanout)
 {
 	const char *p = command_buf.buf + 2;
 	static struct strbuf uq = STRBUF_INIT;
-	struct object_entry *oe = oe;
+	struct object_entry *oe = NULL;
 	struct branch *s;
 	unsigned char sha1[20], commit_sha1[20];
 	char path[60];
@@ -2471,7 +2471,7 @@ static int parse_from(struct branch *b)
 
 static struct hash_list *parse_merge(unsigned int *count)
 {
-	struct hash_list *list = NULL, *n, *e = e;
+	struct hash_list *list = NULL, *n, *e = NULL;
 	const char *from;
 	struct branch *s;
 
-- 
1.7.3

← back to recent threads