Skip to content

Commit

Permalink
Trivial cleanup of track_tree_refs()
Browse files Browse the repository at this point in the history
This makes "track_tree_refs()" use the same "tree_entry()" function for
counting the entries as it does for actually traversing them a few lines
later.

Not a biggie, but the reason I care was that this was the only user of
"update_tree_entry()" that didn't actually *extract* the tree entry first.
It doesn't matter as things stand now, but it meant that a separate
test-patch I had that avoided a few more "strlen()" calls by just saving
the entry length in the entry descriptor and using it directly when
updating wouldn't work without this patch.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Mar 19, 2007
1 parent d55552f commit c711a21
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,8 @@ static void track_tree_refs(struct tree *item)
/* Count how many entries there are.. */
desc.buf = item->buffer;
desc.size = item->size;
while (desc.size) {
while (tree_entry(&desc, &entry))
n_refs++;
update_tree_entry(&desc);
}

/* Allocate object refs and walk it again.. */
i = 0;
Expand Down

0 comments on commit c711a21

Please sign in to comment.