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

2014-01-21 Thread Junio C Hamano
David Kastrup d...@gnu.org writes:

 ---

Thanks.  At some point during its development I must have thought
that having it as a dual-linked list may make it easier when we have
to split a block into pieces, but it seems that split_overlap() does
not need to look at this information.

Needs sign-off.


  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);
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-01-21 Thread David Kastrup
Junio C Hamano gits...@pobox.com writes:

 David Kastrup d...@gnu.org writes:

 ---

 Thanks.  At some point during its development I must have thought
 that having it as a dual-linked list may make it easier when we have
 to split a block into pieces, but it seems that split_overlap() does
 not need to look at this information.

 Needs sign-off.

Well, as I said: it's quite possible that the double-linking might be
useful for some particular hypothetical rewrite of the code.  It isn't
for the current code, and it's not useful for my own rewrite.

Will be posting a signed-off version presently.

-- 
David Kastrup

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-01-21 Thread David Kastrup
Signed-off-by: David Kastrup d...@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

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-01-19 Thread David Kastrup
---
 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

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html