Skip to content

Commit

Permalink
Merge pull request #551 from schu/treebuilder-entries
Browse files Browse the repository at this point in the history
treebuilder: remove needless variable entry_count
  • Loading branch information
Vicent Martí committed Feb 5, 2012
2 parents 1f0c198 + b3408e3 commit 199b7d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
9 changes: 1 addition & 8 deletions src/tree.c
Expand Up @@ -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;

Expand Down Expand Up @@ -486,19 +484,15 @@ 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;

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);
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion src/tree.h
Expand Up @@ -27,7 +27,6 @@ struct git_tree {

struct git_treebuilder {
git_vector entries;
size_t entry_count;
};


Expand Down

0 comments on commit 199b7d9

Please sign in to comment.