From 206f5044a88fc3acc00fdcd1a1668c2833d44d4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20L=C3=A9veill=C3=A9?= <nicolas@uucidl.com>
Date: Sun, 31 Jan 2016 16:55:17 +0100
Subject: [PATCH] Remove warning about tail "potentially uninitialized"

MSVC was complaining that the `tail` variable was potentially
uninitialized in the while branch. Since the while loop is actually
coupled to the if (head != NULL) that initializes the tail variable,
we move them together, which makes the warning disappear.
---
 src/datastructures.c              | 16 ++++++++--------
 tools/windows/hammer_lib_src_list |  3 ++-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/datastructures.c b/src/datastructures.c
index af8477be..451afb94 100644
--- a/src/datastructures.c
+++ b/src/datastructures.c
@@ -52,14 +52,14 @@ HSlist* h_slist_copy(HSlist *slist) {
     h_slist_push(ret, head->elem);
     tail = ret->head;
     head = head->next;
-  }
-  while (head != NULL) {
-    // append head item to tail in a new node
-    HSlistNode *node = h_arena_malloc(slist->arena, sizeof(HSlistNode));
-    node->elem = head->elem;
-    node->next = NULL;
-    tail = tail->next = node;
-    head = head->next;
+    while (head != NULL) {
+      // append head item to tail in a new node
+      HSlistNode *node = h_arena_malloc(slist->arena, sizeof(HSlistNode));
+      node->elem = head->elem;
+      node->next = NULL;
+      tail = tail->next = node;
+      head = head->next;
+    }
   }
   return ret;
 }
diff --git a/tools/windows/hammer_lib_src_list b/tools/windows/hammer_lib_src_list
index 388f92fc..793619ef 100644
--- a/tools/windows/hammer_lib_src_list
+++ b/tools/windows/hammer_lib_src_list
@@ -3,7 +3,8 @@ allocator.c
 benchmark.c
 bitreader.c 
 bitwriter.c 
-cfgrammar.c 
+cfgrammar.c
+datastructures.c
 desugar.c 
 glue.c 
 hammer.c 
-- 
GitLab