treebuilder: remove needless variable entry_count Signed-off-by: schu <schu-github@schulog.org>
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 50 51 52 53 54
diff --git a/src/tree.c b/src/tree.c
index 373d82b..7305627 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -287,8 +287,6 @@ static int append_entry(git_treebuilder *bld, const char *filename, const git_oi
entry->filename = git__strdup(filename);
entry->filename_len = strlen(entry->filename);
- bld->entry_count++;
-
git_oid_cpy(&entry->oid, id);
entry->attr = attributes;
@@ -486,10 +484,8 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
if (pos >= 0) {
entry = git_vector_get(&bld->entries, pos);
- if (entry->removed) {
+ if (entry->removed)
entry->removed = 0;
- bld->entry_count++;
- }
} else {
if ((entry = git__malloc(sizeof(git_tree_entry))) == NULL)
return GIT_ENOMEM;
@@ -497,8 +493,6 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
memset(entry, 0x0, sizeof(git_tree_entry));
entry->filename = git__strdup(filename);
entry->filename_len = strlen(entry->filename);
-
- bld->entry_count++;
}
git_oid_cpy(&entry->oid, id);
@@ -546,7 +540,6 @@ int git_treebuilder_remove(git_treebuilder *bld, const char *filename)
return git__throw(GIT_ENOTFOUND, "Failed to remove entry. File isn't in the tree");
remove_ptr->removed = 1;
- bld->entry_count--;
return GIT_SUCCESS;
}
diff --git a/src/tree.h b/src/tree.h
index 6b2a7d3..f993cea 100644
--- a/src/tree.h
+++ b/src/tree.h
@@ -27,7 +27,6 @@ struct git_tree {
struct git_treebuilder {
git_vector entries;
- size_t entry_count;
};