git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/3] builtin/blame.c: struct blame_entry does not need a prev link

From
David Kastrup <dak@gnu.org>
Date
Jan 25, 2014, 18:23 UTC
Message-ID
<1390674221-25767-2-git-send-email-dak@gnu.org>
In-Reply-To
<1390674221-25767-1-git-send-email-dak@gnu.org>
Signed-off-by: David Kastrup <dak@gnu.org>
---
 builtin/blame.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index e44a6bb..2195595 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -197,7 +197,6 @@ static void drop_origin_blob(struct origin *o)
  * scoreboard structure, sorted by the target line number.
  */
 struct blame_entry {
-	struct blame_entry *prev;
 	struct blame_entry *next;
 
 	/* the first line of this group in the final image;
@@ -282,8 +281,6 @@ static void coalesce(struct scoreboard *sb)
 		    ent->s_lno + ent->num_lines == next->s_lno) {
 			ent->num_lines += next->num_lines;
 			ent->next = next->next;
-			if (ent->next)
-				ent->next->prev = ent;
 			origin_decref(next->suspect);
 			free(next);
 			ent->score = 0;
@@ -534,7 +531,7 @@ static void add_blame_entry(struct scoreboard *sb, struct blame_entry *e)
 		prev = ent;
 
 	/* prev, if not NULL, is the last one that is below e */
-	e->prev = prev;
+
 	if (prev) {
 		e->next = prev->next;
 		prev->next = e;
@@ -543,8 +540,6 @@ static void add_blame_entry(struct scoreboard *sb, struct blame_entry *e)
 		e->next = sb->ent;
 		sb->ent = e;
 	}
-	if (e->next)
-		e->next->prev = e;
 }
 
 /*
@@ -555,14 +550,12 @@ static void add_blame_entry(struct scoreboard *sb, struct blame_entry *e)
  */
 static void dup_entry(struct blame_entry *dst, struct blame_entry *src)
 {
-	struct blame_entry *p, *n;
+	struct blame_entry *n;
 
-	p = dst->prev;
 	n = dst->next;
 	origin_incref(src->suspect);
 	origin_decref(dst->suspect);
 	memcpy(dst, src, sizeof(*src));
-	dst->prev = p;
 	dst->next = n;
 	dst->score = 0;
 }
@@ -2502,8 +2495,6 @@ parse_done:
 		ent->suspect = o;
 		ent->s_lno = bottom;
 		ent->next = next;
-		if (next)
-			next->prev = ent;
 		origin_incref(o);
 	}
 	origin_decref(o);
-- 
1.8.3.2
Previous: David KastrupNext: David Kastrup
Message 3 of 11 in “How to substructure rewrites?”
  1. David KastrupJan 25, 2014
  2. 0/3 "Teaser" patch for rewriting blame for efficiencyDavid Kastrup, Jan 25, 2014
  3. 1/3 builtin/blame.c: struct blame_entry does not need a prev linkDavid Kastrup, Jan 25, 2014
  4. 2/3 Eliminate same_suspect function in builtin/blame.cDavid Kastrup, Jan 25, 2014
  5. 3/3 builtin/blame.c: large-scale rewriteDavid Kastrup, Jan 25, 2014
  6. Junio C HamanoJan 27, 2014
  7. David KastrupJan 27, 2014
  8. Junio C HamanoJan 27, 2014
  9. David KastrupJan 27, 2014
  10. Junio C HamanoJan 27, 2014
  11. David KastrupJan 27, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.