Commit 199b7d94 by Vicent Martí

Merge pull request #551 from schu/treebuilder-entries

treebuilder: remove needless variable entry_count
parents 1f0c1984 b3408e3e
...@@ -287,8 +287,6 @@ static int append_entry(git_treebuilder *bld, const char *filename, const git_oi ...@@ -287,8 +287,6 @@ static int append_entry(git_treebuilder *bld, const char *filename, const git_oi
entry->filename = git__strdup(filename); entry->filename = git__strdup(filename);
entry->filename_len = strlen(entry->filename); entry->filename_len = strlen(entry->filename);
bld->entry_count++;
git_oid_cpy(&entry->oid, id); git_oid_cpy(&entry->oid, id);
entry->attr = attributes; entry->attr = attributes;
...@@ -486,10 +484,8 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con ...@@ -486,10 +484,8 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
if (pos >= 0) { if (pos >= 0) {
entry = git_vector_get(&bld->entries, pos); entry = git_vector_get(&bld->entries, pos);
if (entry->removed) { if (entry->removed)
entry->removed = 0; entry->removed = 0;
bld->entry_count++;
}
} else { } else {
if ((entry = git__malloc(sizeof(git_tree_entry))) == NULL) if ((entry = git__malloc(sizeof(git_tree_entry))) == NULL)
return GIT_ENOMEM; return GIT_ENOMEM;
...@@ -497,8 +493,6 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con ...@@ -497,8 +493,6 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
memset(entry, 0x0, sizeof(git_tree_entry)); memset(entry, 0x0, sizeof(git_tree_entry));
entry->filename = git__strdup(filename); entry->filename = git__strdup(filename);
entry->filename_len = strlen(entry->filename); entry->filename_len = strlen(entry->filename);
bld->entry_count++;
} }
git_oid_cpy(&entry->oid, id); git_oid_cpy(&entry->oid, id);
...@@ -546,7 +540,6 @@ int git_treebuilder_remove(git_treebuilder *bld, const char *filename) ...@@ -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"); return git__throw(GIT_ENOTFOUND, "Failed to remove entry. File isn't in the tree");
remove_ptr->removed = 1; remove_ptr->removed = 1;
bld->entry_count--;
return GIT_SUCCESS; return GIT_SUCCESS;
} }
......
...@@ -27,7 +27,6 @@ struct git_tree { ...@@ -27,7 +27,6 @@ struct git_tree {
struct git_treebuilder { struct git_treebuilder {
git_vector entries; git_vector entries;
size_t entry_count;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment