Re: [PATCH v2 05/16] blame: accept multiple -L ranges

2013-08-06 Thread Junio C Hamano
 + for (range_i = ranges.nr; range_i  0; --range_i) {
 + const struct range *r = ranges.ranges[range_i - 1];
 + long bottom = r-start;
 + long top = r-end;
 + struct blame_entry *next = ent;
 + ent = xcalloc(1, sizeof(*ent));
 + ent-lno = bottom;
 + ent-num_lines = top - bottom;
 + ent-suspect = o;
 + ent-s_lno = bottom;
 + ent-next = next;
 + if (next)
 + next-prev = ent;
 + origin_incref(o);
 + }
 + origin_decref(o);

Hmph, I do not see where the need for this decref is coming from.
Did we incref once too many somewhere?

 + range_set_release(ranges);
 + string_list_clear(range_list, 0);
  
   sb.ent = ent;
   sb.path = path;
--
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 v2 05/16] blame: accept multiple -L ranges

2013-08-06 Thread Junio C Hamano
Eric Sunshine sunsh...@sunshineco.com writes:

 Each constructed blame_entry must own a reference to the suspect.
 o-refcnt should equal the number of blame_entries. At construction, a
 'struct origin' has refcnt 1. In the original code, which supported
 only a single initial range (blame_entry), we had:

   o = get-initial-suspect();  # refcnt already 1
   ent-suspect = o;  # refcnt still 1

Ah, of course.

I forgot that I initialized a new origin with refcnt 1 exactly for
this.  As you use it once for each range, you would need to
compensate for it.

Thanks.
--
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