blame: rename origin-related functions

Functions related to blame_origin that will be publicly exposed should have names that better reflect what they are a part of. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff Smith committed May 24, 2017 at 00:15 UTC 006a0744998804d43a02034bf44b97a163027bb5
1 file changed +29 -29
builtin/blame.c
+29 -29
@@ -180,19 +180,19 @@ static void fill_origin_blob(struct diff_options *opt,
180 * Origin is refcounted and usually we keep the blob contents to be
181 * reused.
182 */
183 -static inline struct blame_origin *origin_incref(struct blame_origin *o)
183 +static inline struct blame_origin *blame_origin_incref(struct blame_origin *o)
184 {
185 if (o)
186 o->refcnt++;
187 return o;
188 }
189
190 -static void origin_decref(struct blame_origin *o)
190 +static void blame_origin_decref(struct blame_origin *o)
191 {
192 if (o && --o->refcnt <= 0) {
193 struct blame_origin *p, *l = NULL;
194 if (o->previous)
195 - origin_decref(o->previous);
195 + blame_origin_decref(o->previous);
196 free(o->file.ptr);
197 /* Should be present exactly once in commit chain */
198 for (p = o->commit->util; p; l = p, p = p->next) {
@@ -205,7 +205,7 @@ static void origin_decref(struct blame_origin *o)
205 return;
206 }
207 }
208 - die("internal error in blame::origin_decref");
208 + die("internal error in blame_origin_decref");
209 }
210 }
211
@@ -393,7 +393,7 @@ static void coalesce(struct blame_scoreboard *sb)
393 ent->s_lno + ent->num_lines == next->s_lno) {
394 ent->num_lines += next->num_lines;
395 ent->next = next->next;
396 - origin_decref(next->suspect);
396 + blame_origin_decref(next->suspect);
397 free(next);
398 ent->score = 0;
399 next = ent; /* again */
@@ -461,7 +461,7 @@ static struct blame_origin *get_origin(struct commit *commit, const char *path)
461 o->next = commit->util;
462 commit->util = o;
463 }
464 - return origin_incref(o);
464 + return blame_origin_incref(o);
465 }
466 }
467 return make_origin(commit, path);
@@ -511,7 +511,7 @@ static struct blame_origin *find_origin(struct commit *parent,
511 * The same path between origin and its parent
512 * without renaming -- the most common case.
513 */
514 - return origin_incref (porigin);
514 + return blame_origin_incref (porigin);
515 }
516
517 /* See if the origin->path is different between parent
@@ -630,7 +630,7 @@ static void add_blame_entry(struct blame_entry ***queue,
630 {
631 struct blame_entry *e = xmalloc(sizeof(*e));
632 memcpy(e, src, sizeof(*e));
633 - origin_incref(e->suspect);
633 + blame_origin_incref(e->suspect);
634
635 e->next = **queue;
636 **queue = e;
@@ -645,8 +645,8 @@ static void add_blame_entry(struct blame_entry ***queue,
645 static void dup_entry(struct blame_entry ***queue,
646 struct blame_entry *dst, struct blame_entry *src)
647 {
648 - origin_incref(src->suspect);
649 - origin_decref(dst->suspect);
648 + blame_origin_incref(src->suspect);
649 + blame_origin_decref(dst->suspect);
650 memcpy(dst, src, sizeof(*src));
651 dst->next = **queue;
652 **queue = dst;
@@ -687,7 +687,7 @@ static void split_overlap(struct blame_entry *split,
687
688 if (e->s_lno < tlno) {
689 /* there is a pre-chunk part not blamed on parent */
690 - split[0].suspect = origin_incref(e->suspect);
690 + split[0].suspect = blame_origin_incref(e->suspect);
691 split[0].lno = e->lno;
692 split[0].s_lno = e->s_lno;
693 split[0].num_lines = tlno - e->s_lno;
@@ -701,7 +701,7 @@ static void split_overlap(struct blame_entry *split,
701
702 if (same < e->s_lno + e->num_lines) {
703 /* there is a post-chunk part not blamed on parent */
704 - split[2].suspect = origin_incref(e->suspect);
704 + split[2].suspect = blame_origin_incref(e->suspect);
705 split[2].lno = e->lno + (same - e->s_lno);
706 split[2].s_lno = e->s_lno + (same - e->s_lno);
707 split[2].num_lines = e->s_lno + e->num_lines - same;
@@ -717,7 +717,7 @@ static void split_overlap(struct blame_entry *split,
717 */
718 if (split[1].num_lines < 1)
719 return;
720 - split[1].suspect = origin_incref(parent);
720 + split[1].suspect = blame_origin_incref(parent);
721 }
722
723 /*
@@ -767,7 +767,7 @@ static void decref_split(struct blame_entry *split)
767 int i;
768
769 for (i = 0; i < 3; i++)
770 - origin_decref(split[i].suspect);
770 + blame_origin_decref(split[i].suspect);
771 }
772
773 /*
@@ -830,10 +830,10 @@ static void blame_chunk(struct blame_entry ***dstq, struct blame_entry ***srcq,
830 n->next = diffp;
831 diffp = n;
832 } else
833 - origin_decref(e->suspect);
833 + blame_origin_decref(e->suspect);
834 /* Pass blame for everything before the differing
835 * chunk to the parent */
836 - e->suspect = origin_incref(parent);
836 + e->suspect = blame_origin_incref(parent);
837 e->s_lno += offset;
838 e->next = samep;
839 samep = e;
@@ -874,7 +874,7 @@ static void blame_chunk(struct blame_entry ***dstq, struct blame_entry ***srcq,
874 */
875 int len = same - e->s_lno;
876 struct blame_entry *n = xcalloc(1, sizeof (struct blame_entry));
877 - n->suspect = origin_incref(e->suspect);
877 + n->suspect = blame_origin_incref(e->suspect);
878 n->lno = e->lno + len;
879 n->s_lno = e->s_lno + len;
880 n->num_lines = e->num_lines - len;
@@ -1000,7 +1000,7 @@ static void copy_split_if_better(struct blame_scoreboard *sb,
1000 }
1001
1002 for (i = 0; i < 3; i++)
1003 - origin_incref(this[i].suspect);
1003 + blame_origin_incref(this[i].suspect);
1004 decref_split(best_so_far);
1005 memcpy(best_so_far, this, sizeof(struct blame_entry [3]));
1006 }
@@ -1280,7 +1280,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
1280 this);
1281 decref_split(this);
1282 }
1283 - origin_decref(norigin);
1283 + blame_origin_decref(norigin);
1284 }
1285
1286 for (j = 0; j < num_ents; j++) {
@@ -1321,8 +1321,8 @@ static void pass_whole_blame(struct blame_scoreboard *sb,
1321 suspects = origin->suspects;
1322 origin->suspects = NULL;
1323 for (e = suspects; e; e = e->next) {
1324 - origin_incref(porigin);
1325 - origin_decref(e->suspect);
1324 + blame_origin_incref(porigin);
1325 + blame_origin_decref(e->suspect);
1326 e->suspect = porigin;
1327 }
1328 queue_blames(sb, porigin, suspects);
@@ -1418,7 +1418,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
1418 continue;
1419 if (!oidcmp(&porigin->blob_oid, &origin->blob_oid)) {
1420 pass_whole_blame(sb, origin, porigin);
1421 - origin_decref(porigin);
1421 + blame_origin_decref(porigin);
1422 goto finish;
1423 }
1424 for (j = same = 0; j < i; j++)
@@ -1430,7 +1430,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
1430 if (!same)
1431 sg_origin[i] = porigin;
1432 else
1433 - origin_decref(porigin);
1433 + blame_origin_decref(porigin);
1434 }
1435 }
1436
@@ -1442,7 +1442,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
1442 if (!porigin)
1443 continue;
1444 if (!origin->previous) {
1445 - origin_incref(porigin);
1445 + blame_origin_incref(porigin);
1446 origin->previous = porigin;
1447 }
1448 pass_blame_to_parent(sb, origin, porigin);
@@ -1513,7 +1513,7 @@ finish:
1513 for (i = 0; i < num_sg; i++) {
1514 if (sg_origin[i]) {
1515 drop_origin_blob(sg_origin[i]);
1516 - origin_decref(sg_origin[i]);
1516 + blame_origin_decref(sg_origin[i]);
1517 }
1518 }
1519 drop_origin_blob(origin);
@@ -1762,7 +1762,7 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
1762 * We will use this suspect later in the loop,
1763 * so hold onto it in the meantime.
1764 */
1765 - origin_incref(suspect);
1765 + blame_origin_incref(suspect);
1766 parse_commit(commit);
1767 if (reverse ||
1768 (!(commit->object.flags & UNINTERESTING) &&
@@ -1794,7 +1794,7 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
1794 break;
1795 }
1796 }
1797 - origin_decref(suspect);
1797 + blame_origin_decref(suspect);
1798
1799 if (DEBUG) /* sanity */
1800 sanity_check_refcnt(sb);
@@ -2857,13 +2857,13 @@ parse_done:
2857 ent->suspect = o;
2858 ent->s_lno = bottom;
2859 ent->next = next;
2860 - origin_incref(o);
2860 + blame_origin_incref(o);
2861 }
2862
2863 o->suspects = ent;
2864 prio_queue_put(&sb.commits, o->commit);
2865
2866 - origin_decref(o);
2866 + blame_origin_decref(o);
2867
2868 range_set_release(&ranges);
2869 string_list_clear(&range_list, 0);