clar: Fix warnings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
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;