git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Trivial cleanup of track_tree_refs()
@ 2007-03-18 20:38 Linus Torvalds
  0 siblings, 0 replies; only message in thread
From: Linus Torvalds @ 2007-03-18 20:38 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


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>
---
 tree.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/tree.c b/tree.c
index 46923ee..24f8fb6 100644
--- a/tree.c
+++ b/tree.c
@@ -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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-18 20:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-18 20:38 Trivial cleanup of track_tree_refs() Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).