summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2014-10-27 12:19:42 -0700
committerEdward Thomson <ethomson@edwardthomson.com>2014-10-27 12:19:42 -0700
commit7647f4495dae86c730d50152d50ad779900e1088 (patch)
tree2e9906f6f6998b76ef8c2ffe8cf48e5f6b60bff8
parent116a19d4674237af7a8ff1e1822e3033e1f8f0d7 (diff)
parent64bcf567c30af6162f756f661c9f2a14f861deb4 (diff)
downloadlibgit2-7647f4495dae86c730d50152d50ad779900e1088.tar.gz
Merge pull request #2659 from swisspol/static_analysis
Fixed the most obvious Clang static analyzer warnings
-rw-r--r--src/describe.c4
-rw-r--r--src/diff_tform.c2
-rw-r--r--src/oid.c2
-rw-r--r--src/pack.c1
-rw-r--r--src/remote.c2
5 files changed, 3 insertions, 8 deletions
diff --git a/src/describe.c b/src/describe.c
index fb39c58fe..a193fcbcb 100644
--- a/src/describe.c
+++ b/src/describe.c
@@ -571,8 +571,6 @@ static int describe(
}
}
- best = (struct possible_tag *)git_vector_get(&all_matches, 0);
-
git_vector_sort(&all_matches);
best = (struct possible_tag *)git_vector_get(&all_matches, 0);
@@ -727,7 +725,7 @@ int git_describe_workdir(
git_oid current_id;
git_status_list *status = NULL;
git_status_options status_opts = GIT_STATUS_OPTIONS_INIT;
- git_describe_result *result;
+ git_describe_result *result = NULL;
git_object *commit;
if ((error = git_reference_name_to_id(&current_id, repo, GIT_HEAD_FILE)) < 0)
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 9ebce06a0..d576317f0 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -949,8 +949,6 @@ find_best_matches:
* Rewrite the diffs with renames / copies
*/
- tried_tgts = 0;
-
git_vector_foreach(&diff->deltas, t, tgt) {
/* skip things that are not rename targets */
if ((tgt->flags & GIT_DIFF_FLAG__IS_RENAME_TARGET) == 0)
diff --git a/src/oid.c b/src/oid.c
index 969931d04..5d29200b6 100644
--- a/src/oid.c
+++ b/src/oid.c
@@ -211,7 +211,7 @@ int git_oid_ncmp(const git_oid *oid_a, const git_oid *oid_b, size_t len)
int git_oid_strcmp(const git_oid *oid_a, const char *str)
{
- const unsigned char *a = oid_a->id;
+ const unsigned char *a;
unsigned char strval;
int hexval;
diff --git a/src/pack.c b/src/pack.c
index 516e0f3ca..79032381c 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -1105,7 +1105,6 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
p->pack_keep = 1;
memcpy(p->pack_name + root_len, ".pack", sizeof(".pack"));
- path_len = path_len - strlen(".idx") + strlen(".pack");
}
if (p_stat(p->pack_name, &st) < 0 || !S_ISREG(st.st_mode)) {
diff --git a/src/remote.c b/src/remote.c
index 4629175d0..0ae377e47 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1691,7 +1691,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
{
int error;
git_vector problem_refspecs = GIT_VECTOR_INIT;
- git_remote *remote;
+ git_remote *remote = NULL;
assert(out && repo && name && new_name);