Commit 8c4c357f1830c246c1935c84aacc606e5d0762be

Vicent Marti 2012-06-19T02:43:36

clar: Fix warnings

diff --git a/src/revparse.c b/src/revparse.c
index c66a985..4d6ffb5 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -537,7 +537,7 @@ static int oid_for_tree_path(git_oid *out, git_tree *tree, git_repository *repo,
    char *tok;
    void *alloc = str;
    git_tree *tree2 = tree;
-   const git_tree_entry *entry;
+   const git_tree_entry *entry = NULL;
 
    while ((tok = git__strtok(&str, "/\\")) != NULL) {
       entry = git_tree_entry_byname(tree2, tok);
diff --git a/tests-clar/object/tree/write.c b/tests-clar/object/tree/write.c
index a783120..8b0f341 100644
--- a/tests-clar/object/tree/write.c
+++ b/tests-clar/object/tree/write.c
@@ -89,7 +89,8 @@ void test_object_tree_write__subtree(void)
 void test_object_tree_write__sorted_subtrees(void)
 {
 	git_treebuilder *builder;
-	unsigned int i, position_c, position_cake, position_config;
+	unsigned int i;
+	int position_c = -1, position_cake = -1, position_config = -1;
 
 	struct {
 		unsigned int attr;
@@ -140,6 +141,10 @@ void test_object_tree_write__sorted_subtrees(void)
 			position_config = i;
 	}
 
+	cl_assert(position_c != -1);
+	cl_assert(position_cake != -1);
+	cl_assert(position_config != -1);
+
 	cl_assert(position_c < position_cake);
 	cl_assert(position_cake < position_config);
 
diff --git a/tests-clar/revwalk/mergebase.c b/tests-clar/revwalk/mergebase.c
index 5339171..a210c1f 100644
--- a/tests-clar/revwalk/mergebase.c
+++ b/tests-clar/revwalk/mergebase.c
@@ -1,5 +1,6 @@
 #include "clar_libgit2.h"
 #include "vector.h"
+#include <stdarg.h>
 
 static git_repository *_repo;