Fix uninitialized var 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
diff --git a/src/index.c b/src/index.c
index 6290ec4..2afd281 100644
--- a/src/index.c
+++ b/src/index.c
@@ -1345,7 +1345,7 @@ static size_t read_extension(git_index *index, const char *buffer, size_t buffer
static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
{
unsigned int i;
- struct index_header header;
+ struct index_header header = { 0 };
git_oid checksum_calculated, checksum_expected;
#define seek_forward(_increase) { \
diff --git a/src/revparse.c b/src/revparse.c
index 74635ed..8a22a04 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -16,7 +16,7 @@
static int disambiguate_refname(git_reference **out, git_repository *repo, const char *refname)
{
- int error, i;
+ int error = 0, i;
bool fallbackmode = true;
git_reference *ref;
git_buf refnamebuf = GIT_BUF_INIT, name = GIT_BUF_INIT;
diff --git a/tests-clar/repo/iterator.c b/tests-clar/repo/iterator.c
index 2e53c48..9118dd1 100644
--- a/tests-clar/repo/iterator.c
+++ b/tests-clar/repo/iterator.c
@@ -422,7 +422,7 @@ static void build_test_tree(
git_treebuilder *builder;
const char *scan = fmt, *next;
char type, delimiter;
- git_filemode_t mode;
+ git_filemode_t mode = GIT_FILEMODE_BLOB;
git_buf name = GIT_BUF_INIT;
va_list arglist;