Skip to content

Commit 006a074

Browse files
whydoubtgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9807b3d commit 006a074

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

builtin/blame.c

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,19 @@ static void fill_origin_blob(struct diff_options *opt,
180180
* Origin is refcounted and usually we keep the blob contents to be
181181
* reused.
182182
*/
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)
184184
{
185185
if (o)
186186
o->refcnt++;
187187
return o;
188188
}
189189

190-
static void origin_decref(struct blame_origin *o)
190+
static void blame_origin_decref(struct blame_origin *o)
191191
{
192192
if (o && --o->refcnt <= 0) {
193193
struct blame_origin *p, *l = NULL;
194194
if (o->previous)
195-
origin_decref(o->previous);
195+
blame_origin_decref(o->previous);
196196
free(o->file.ptr);
197197
/* Should be present exactly once in commit chain */
198198
for (p = o->commit->util; p; l = p, p = p->next) {
@@ -205,7 +205,7 @@ static void origin_decref(struct blame_origin *o)
205205
return;
206206
}
207207
}
208-
die("internal error in blame::origin_decref");
208+
die("internal error in blame_origin_decref");
209209
}
210210
}
211211

@@ -393,7 +393,7 @@ static void coalesce(struct blame_scoreboard *sb)
393393
ent->s_lno + ent->num_lines == next->s_lno) {
394394
ent->num_lines += next->num_lines;
395395
ent->next = next->next;
396-
origin_decref(next->suspect);
396+
blame_origin_decref(next->suspect);
397397
free(next);
398398
ent->score = 0;
399399
next = ent; /* again */
@@ -461,7 +461,7 @@ static struct blame_origin *get_origin(struct commit *commit, const char *path)
461461
o->next = commit->util;
462462
commit->util = o;
463463
}
464-
return origin_incref(o);
464+
return blame_origin_incref(o);
465465
}
466466
}
467467
return make_origin(commit, path);
@@ -511,7 +511,7 @@ static struct blame_origin *find_origin(struct commit *parent,
511511
* The same path between origin and its parent
512512
* without renaming -- the most common case.
513513
*/
514-
return origin_incref (porigin);
514+
return blame_origin_incref (porigin);
515515
}
516516

517517
/* See if the origin->path is different between parent
@@ -630,7 +630,7 @@ static void add_blame_entry(struct blame_entry ***queue,
630630
{
631631
struct blame_entry *e = xmalloc(sizeof(*e));
632632
memcpy(e, src, sizeof(*e));
633-
origin_incref(e->suspect);
633+
blame_origin_incref(e->suspect);
634634

635635
e->next = **queue;
636636
**queue = e;
@@ -645,8 +645,8 @@ static void add_blame_entry(struct blame_entry ***queue,
645645
static void dup_entry(struct blame_entry ***queue,
646646
struct blame_entry *dst, struct blame_entry *src)
647647
{
648-
origin_incref(src->suspect);
649-
origin_decref(dst->suspect);
648+
blame_origin_incref(src->suspect);
649+
blame_origin_decref(dst->suspect);
650650
memcpy(dst, src, sizeof(*src));
651651
dst->next = **queue;
652652
**queue = dst;
@@ -687,7 +687,7 @@ static void split_overlap(struct blame_entry *split,
687687

688688
if (e->s_lno < tlno) {
689689
/* 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);
691691
split[0].lno = e->lno;
692692
split[0].s_lno = e->s_lno;
693693
split[0].num_lines = tlno - e->s_lno;
@@ -701,7 +701,7 @@ static void split_overlap(struct blame_entry *split,
701701

702702
if (same < e->s_lno + e->num_lines) {
703703
/* 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);
705705
split[2].lno = e->lno + (same - e->s_lno);
706706
split[2].s_lno = e->s_lno + (same - e->s_lno);
707707
split[2].num_lines = e->s_lno + e->num_lines - same;
@@ -717,7 +717,7 @@ static void split_overlap(struct blame_entry *split,
717717
*/
718718
if (split[1].num_lines < 1)
719719
return;
720-
split[1].suspect = origin_incref(parent);
720+
split[1].suspect = blame_origin_incref(parent);
721721
}
722722

723723
/*
@@ -767,7 +767,7 @@ static void decref_split(struct blame_entry *split)
767767
int i;
768768

769769
for (i = 0; i < 3; i++)
770-
origin_decref(split[i].suspect);
770+
blame_origin_decref(split[i].suspect);
771771
}
772772

773773
/*
@@ -830,10 +830,10 @@ static void blame_chunk(struct blame_entry ***dstq, struct blame_entry ***srcq,
830830
n->next = diffp;
831831
diffp = n;
832832
} else
833-
origin_decref(e->suspect);
833+
blame_origin_decref(e->suspect);
834834
/* Pass blame for everything before the differing
835835
* chunk to the parent */
836-
e->suspect = origin_incref(parent);
836+
e->suspect = blame_origin_incref(parent);
837837
e->s_lno += offset;
838838
e->next = samep;
839839
samep = e;
@@ -874,7 +874,7 @@ static void blame_chunk(struct blame_entry ***dstq, struct blame_entry ***srcq,
874874
*/
875875
int len = same - e->s_lno;
876876
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);
878878
n->lno = e->lno + len;
879879
n->s_lno = e->s_lno + len;
880880
n->num_lines = e->num_lines - len;
@@ -1000,7 +1000,7 @@ static void copy_split_if_better(struct blame_scoreboard *sb,
10001000
}
10011001

10021002
for (i = 0; i < 3; i++)
1003-
origin_incref(this[i].suspect);
1003+
blame_origin_incref(this[i].suspect);
10041004
decref_split(best_so_far);
10051005
memcpy(best_so_far, this, sizeof(struct blame_entry [3]));
10061006
}
@@ -1280,7 +1280,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
12801280
this);
12811281
decref_split(this);
12821282
}
1283-
origin_decref(norigin);
1283+
blame_origin_decref(norigin);
12841284
}
12851285

12861286
for (j = 0; j < num_ents; j++) {
@@ -1321,8 +1321,8 @@ static void pass_whole_blame(struct blame_scoreboard *sb,
13211321
suspects = origin->suspects;
13221322
origin->suspects = NULL;
13231323
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);
13261326
e->suspect = porigin;
13271327
}
13281328
queue_blames(sb, porigin, suspects);
@@ -1418,7 +1418,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
14181418
continue;
14191419
if (!oidcmp(&porigin->blob_oid, &origin->blob_oid)) {
14201420
pass_whole_blame(sb, origin, porigin);
1421-
origin_decref(porigin);
1421+
blame_origin_decref(porigin);
14221422
goto finish;
14231423
}
14241424
for (j = same = 0; j < i; j++)
@@ -1430,7 +1430,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
14301430
if (!same)
14311431
sg_origin[i] = porigin;
14321432
else
1433-
origin_decref(porigin);
1433+
blame_origin_decref(porigin);
14341434
}
14351435
}
14361436

@@ -1442,7 +1442,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
14421442
if (!porigin)
14431443
continue;
14441444
if (!origin->previous) {
1445-
origin_incref(porigin);
1445+
blame_origin_incref(porigin);
14461446
origin->previous = porigin;
14471447
}
14481448
pass_blame_to_parent(sb, origin, porigin);
@@ -1513,7 +1513,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
15131513
for (i = 0; i < num_sg; i++) {
15141514
if (sg_origin[i]) {
15151515
drop_origin_blob(sg_origin[i]);
1516-
origin_decref(sg_origin[i]);
1516+
blame_origin_decref(sg_origin[i]);
15171517
}
15181518
}
15191519
drop_origin_blob(origin);
@@ -1762,7 +1762,7 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
17621762
* We will use this suspect later in the loop,
17631763
* so hold onto it in the meantime.
17641764
*/
1765-
origin_incref(suspect);
1765+
blame_origin_incref(suspect);
17661766
parse_commit(commit);
17671767
if (reverse ||
17681768
(!(commit->object.flags & UNINTERESTING) &&
@@ -1794,7 +1794,7 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
17941794
break;
17951795
}
17961796
}
1797-
origin_decref(suspect);
1797+
blame_origin_decref(suspect);
17981798

17991799
if (DEBUG) /* sanity */
18001800
sanity_check_refcnt(sb);
@@ -2857,13 +2857,13 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
28572857
ent->suspect = o;
28582858
ent->s_lno = bottom;
28592859
ent->next = next;
2860-
origin_incref(o);
2860+
blame_origin_incref(o);
28612861
}
28622862

28632863
o->suspects = ent;
28642864
prio_queue_put(&sb.commits, o->commit);
28652865

2866-
origin_decref(o);
2866+
blame_origin_decref(o);
28672867

28682868
range_set_release(&ranges);
28692869
string_list_clear(&range_list, 0);

0 commit comments

Comments
 (0)