Skip to contentSkip to conversation

fast-import.c: Initialise variables to suppress msvc warnings

PATCH In review Ramsay Jones 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 7/14 fast-import.c: Initialise variables to suppress msvc warnings

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.

---
 fast-import.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fast-import.c +3 -3
index 8263dbe..1d7cd03 100644
@@ -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;
 
Signature · 1 line
1.7.3