git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: Trivial cleanup of track_tree_refs()
Date: Sun, 18 Mar 2007 13:38:19 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0703181333190.6730@woody.linux-foundation.org> (raw)


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;

                 reply	other threads:[~2007-03-18 20:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0703181333190.6730@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).