Git development
 help / color / mirror / Atom feed
* [PATCH] Remove unused code in parse_commit_buffer()
@ 2008-06-07 20:38 Miklos Vajna
  2008-06-08 15:46 ` Johannes Schindelin
  0 siblings, 1 reply; 2+ messages in thread
From: Miklos Vajna @ 2008-06-07 20:38 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

The n_refs variable is no longer really used in this function, so there
is no reason to keep it.

It was introduced in 27dedf0c and the code that really used it was
removed in 7914053.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 commit.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/commit.c b/commit.c
index 94d5b3d..e2d8624 100644
--- a/commit.c
+++ b/commit.c
@@ -243,7 +243,6 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
 	unsigned char parent[20];
 	struct commit_list **pptr;
 	struct commit_graft *graft;
-	unsigned n_refs = 0;
 
 	if (item->object.parsed)
 		return 0;
@@ -255,8 +254,6 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
 		return error("bad tree pointer in commit %s",
 			     sha1_to_hex(item->object.sha1));
 	item->tree = lookup_tree(parent);
-	if (item->tree)
-		n_refs++;
 	bufptr += 46; /* "tree " + "hex sha1" + "\n" */
 	pptr = &item->parents;
 
@@ -272,10 +269,8 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
 		if (graft)
 			continue;
 		new_parent = lookup_commit(parent);
-		if (new_parent) {
+		if (new_parent)
 			pptr = &commit_list_insert(new_parent, pptr)->next;
-			n_refs++;
-		}
 	}
 	if (graft) {
 		int i;
@@ -285,7 +280,6 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
 			if (!new_parent)
 				continue;
 			pptr = &commit_list_insert(new_parent, pptr)->next;
-			n_refs++;
 		}
 	}
 	item->date = parse_commit_date(bufptr, tail);
-- 
1.5.6.rc0.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Remove unused code in parse_commit_buffer()
  2008-06-07 20:38 [PATCH] Remove unused code in parse_commit_buffer() Miklos Vajna
@ 2008-06-08 15:46 ` Johannes Schindelin
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Schindelin @ 2008-06-08 15:46 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, git

Hi,

On Sat, 7 Jun 2008, Miklos Vajna wrote:

> The n_refs variable is no longer really used in this function, so there
> is no reason to keep it.
> 
> It was introduced in 27dedf0c and the code that really used it was
> removed in 7914053.

Nice catch!

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-08 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-07 20:38 [PATCH] Remove unused code in parse_commit_buffer() Miklos Vajna
2008-06-08 15:46 ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox