зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
9807b3d65d
Коммит
006a074499
|
@ -180,19 +180,19 @@ static void fill_origin_blob(struct diff_options *opt,
|
|||
* Origin is refcounted and usually we keep the blob contents to be
|
||||
* reused.
|
||||
*/
|
||||
static inline struct blame_origin *origin_incref(struct blame_origin *o)
|
||||
static inline struct blame_origin *blame_origin_incref(struct blame_origin *o)
|
||||
{
|
||||
if (o)
|
||||
o->refcnt++;
|
||||
return o;
|
||||
}
|
||||
|
||||
static void origin_decref(struct blame_origin *o)
|
||||
static void blame_origin_decref(struct blame_origin *o)
|
||||
{
|
||||
if (o && --o->refcnt <= 0) {
|
||||
struct blame_origin *p, *l = NULL;
|
||||
if (o->previous)
|
||||
origin_decref(o->previous);
|
||||
blame_origin_decref(o->previous);
|
||||
free(o->file.ptr);
|
||||
/* Should be present exactly once in commit chain */
|
||||
for (p = o->commit->util; p; l = p, p = p->next) {
|
||||
|
@ -205,7 +205,7 @@ static void origin_decref(struct blame_origin *o)
|
|||
return;
|
||||
}
|
||||
}
|
||||
die("internal error in blame::origin_decref");
|
||||
die("internal error in blame_origin_decref");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ static void coalesce(struct blame_scoreboard *sb)
|
|||
ent->s_lno + ent->num_lines == next->s_lno) {
|
||||
ent->num_lines += next->num_lines;
|
||||
ent->next = next->next;
|
||||
origin_decref(next->suspect);
|
||||
blame_origin_decref(next->suspect);
|
||||
free(next);
|
||||
ent->score = 0;
|
||||
next = ent; /* again */
|
||||
|
@ -461,7 +461,7 @@ static struct blame_origin *get_origin(struct commit *commit, const char *path)
|
|||
o->next = commit->util;
|
||||
commit->util = o;
|
||||
}
|
||||
return origin_incref(o);
|
||||
return blame_origin_incref(o);
|
||||
}
|
||||
}
|
||||
return make_origin(commit, path);
|
||||
|
@ -511,7 +511,7 @@ static struct blame_origin *find_origin(struct commit *parent,
|
|||
* The same path between origin and its parent
|
||||
* without renaming -- the most common case.
|
||||
*/
|
||||
return origin_incref (porigin);
|
||||
return blame_origin_incref (porigin);
|
||||
}
|
||||
|
||||
/* See if the origin->path is different between parent
|
||||
|
@ -630,7 +630,7 @@ static void add_blame_entry(struct blame_entry ***queue,
|
|||
{
|
||||
struct blame_entry *e = xmalloc(sizeof(*e));
|
||||
memcpy(e, src, sizeof(*e));
|
||||
origin_incref(e->suspect);
|
||||
blame_origin_incref(e->suspect);
|
||||
|
||||
e->next = **queue;
|
||||
**queue = e;
|
||||
|
@ -645,8 +645,8 @@ static void add_blame_entry(struct blame_entry ***queue,
|
|||
static void dup_entry(struct blame_entry ***queue,
|
||||
struct blame_entry *dst, struct blame_entry *src)
|
||||
{
|
||||
origin_incref(src->suspect);
|
||||
origin_decref(dst->suspect);
|
||||
blame_origin_incref(src->suspect);
|
||||
blame_origin_decref(dst->suspect);
|
||||
memcpy(dst, src, sizeof(*src));
|
||||
dst->next = **queue;
|
||||
**queue = dst;
|
||||
|
@ -687,7 +687,7 @@ static void split_overlap(struct blame_entry *split,
|
|||
|
||||
if (e->s_lno < tlno) {
|
||||
/* there is a pre-chunk part not blamed on parent */
|
||||
split[0].suspect = origin_incref(e->suspect);
|
||||
split[0].suspect = blame_origin_incref(e->suspect);
|
||||
split[0].lno = e->lno;
|
||||
split[0].s_lno = e->s_lno;
|
||||
split[0].num_lines = tlno - e->s_lno;
|
||||
|
@ -701,7 +701,7 @@ static void split_overlap(struct blame_entry *split,
|
|||
|
||||
if (same < e->s_lno + e->num_lines) {
|
||||
/* there is a post-chunk part not blamed on parent */
|
||||
split[2].suspect = origin_incref(e->suspect);
|
||||
split[2].suspect = blame_origin_incref(e->suspect);
|
||||
split[2].lno = e->lno + (same - e->s_lno);
|
||||
split[2].s_lno = e->s_lno + (same - e->s_lno);
|
||||
split[2].num_lines = e->s_lno + e->num_lines - same;
|
||||
|
@ -717,7 +717,7 @@ static void split_overlap(struct blame_entry *split,
|
|||
*/
|
||||
if (split[1].num_lines < 1)
|
||||
return;
|
||||
split[1].suspect = origin_incref(parent);
|
||||
split[1].suspect = blame_origin_incref(parent);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -767,7 +767,7 @@ static void decref_split(struct blame_entry *split)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
origin_decref(split[i].suspect);
|
||||
blame_origin_decref(split[i].suspect);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -830,10 +830,10 @@ static void blame_chunk(struct blame_entry ***dstq, struct blame_entry ***srcq,
|
|||
n->next = diffp;
|
||||
diffp = n;
|
||||
} else
|
||||
origin_decref(e->suspect);
|
||||
blame_origin_decref(e->suspect);
|
||||
/* Pass blame for everything before the differing
|
||||
* chunk to the parent */
|
||||
e->suspect = origin_incref(parent);
|
||||
e->suspect = blame_origin_incref(parent);
|
||||
e->s_lno += offset;
|
||||
e->next = samep;
|
||||
samep = e;
|
||||
|
@ -874,7 +874,7 @@ static void blame_chunk(struct blame_entry ***dstq, struct blame_entry ***srcq,
|
|||
*/
|
||||
int len = same - e->s_lno;
|
||||
struct blame_entry *n = xcalloc(1, sizeof (struct blame_entry));
|
||||
n->suspect = origin_incref(e->suspect);
|
||||
n->suspect = blame_origin_incref(e->suspect);
|
||||
n->lno = e->lno + len;
|
||||
n->s_lno = e->s_lno + len;
|
||||
n->num_lines = e->num_lines - len;
|
||||
|
@ -1000,7 +1000,7 @@ static void copy_split_if_better(struct blame_scoreboard *sb,
|
|||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
origin_incref(this[i].suspect);
|
||||
blame_origin_incref(this[i].suspect);
|
||||
decref_split(best_so_far);
|
||||
memcpy(best_so_far, this, sizeof(struct blame_entry [3]));
|
||||
}
|
||||
|
@ -1280,7 +1280,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
|
|||
this);
|
||||
decref_split(this);
|
||||
}
|
||||
origin_decref(norigin);
|
||||
blame_origin_decref(norigin);
|
||||
}
|
||||
|
||||
for (j = 0; j < num_ents; j++) {
|
||||
|
@ -1321,8 +1321,8 @@ static void pass_whole_blame(struct blame_scoreboard *sb,
|
|||
suspects = origin->suspects;
|
||||
origin->suspects = NULL;
|
||||
for (e = suspects; e; e = e->next) {
|
||||
origin_incref(porigin);
|
||||
origin_decref(e->suspect);
|
||||
blame_origin_incref(porigin);
|
||||
blame_origin_decref(e->suspect);
|
||||
e->suspect = porigin;
|
||||
}
|
||||
queue_blames(sb, porigin, suspects);
|
||||
|
@ -1418,7 +1418,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
continue;
|
||||
if (!oidcmp(&porigin->blob_oid, &origin->blob_oid)) {
|
||||
pass_whole_blame(sb, origin, porigin);
|
||||
origin_decref(porigin);
|
||||
blame_origin_decref(porigin);
|
||||
goto finish;
|
||||
}
|
||||
for (j = same = 0; j < i; j++)
|
||||
|
@ -1430,7 +1430,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
if (!same)
|
||||
sg_origin[i] = porigin;
|
||||
else
|
||||
origin_decref(porigin);
|
||||
blame_origin_decref(porigin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1442,7 +1442,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
if (!porigin)
|
||||
continue;
|
||||
if (!origin->previous) {
|
||||
origin_incref(porigin);
|
||||
blame_origin_incref(porigin);
|
||||
origin->previous = porigin;
|
||||
}
|
||||
pass_blame_to_parent(sb, origin, porigin);
|
||||
|
@ -1513,7 +1513,7 @@ finish:
|
|||
for (i = 0; i < num_sg; i++) {
|
||||
if (sg_origin[i]) {
|
||||
drop_origin_blob(sg_origin[i]);
|
||||
origin_decref(sg_origin[i]);
|
||||
blame_origin_decref(sg_origin[i]);
|
||||
}
|
||||
}
|
||||
drop_origin_blob(origin);
|
||||
|
@ -1762,7 +1762,7 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
|
|||
* We will use this suspect later in the loop,
|
||||
* so hold onto it in the meantime.
|
||||
*/
|
||||
origin_incref(suspect);
|
||||
blame_origin_incref(suspect);
|
||||
parse_commit(commit);
|
||||
if (reverse ||
|
||||
(!(commit->object.flags & UNINTERESTING) &&
|
||||
|
@ -1794,7 +1794,7 @@ static void assign_blame(struct blame_scoreboard *sb, int opt)
|
|||
break;
|
||||
}
|
||||
}
|
||||
origin_decref(suspect);
|
||||
blame_origin_decref(suspect);
|
||||
|
||||
if (DEBUG) /* sanity */
|
||||
sanity_check_refcnt(sb);
|
||||
|
@ -2857,13 +2857,13 @@ parse_done:
|
|||
ent->suspect = o;
|
||||
ent->s_lno = bottom;
|
||||
ent->next = next;
|
||||
origin_incref(o);
|
||||
blame_origin_incref(o);
|
||||
}
|
||||
|
||||
o->suspects = ent;
|
||||
prio_queue_put(&sb.commits, o->commit);
|
||||
|
||||
origin_decref(o);
|
||||
blame_origin_decref(o);
|
||||
|
||||
range_set_release(&ranges);
|
||||
string_list_clear(&range_list, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче