Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
blame: rename origin-related functions
author
Jeff Smith
<whydoubt@gmail.com>
Wed, 24 May 2017 05:15:14 +0000
(
00:15
-0500)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 24 May 2017 06:41:51 +0000
(15:41 +0900)
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>
builtin/blame.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
9807b3d
)
diff --git
a/builtin/blame.c
b/builtin/blame.c
index 717868e7e38a6197a916bd129fc04d88ac553caa..7854770d85a33ba14116f94323250a53ad933fdb 100644
(file)
--- a/
builtin/blame.c
+++ b/
builtin/blame.c
@@
-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.
*/
* 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;
}
{
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)
{
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) {
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;
}
}
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;
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 */
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;
}
o->next = commit->util;
commit->util = o;
}
- return origin_incref(o);
+ return
blame_
origin_incref(o);
}
}
return make_origin(commit, path);
}
}
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.
*/
* 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
}
/* 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));
{
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;
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)
{
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;
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 */
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;
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 */
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;
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;
*/
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++)
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
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 */
/* 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;
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));
*/
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;
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++)
}
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]));
}
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);
}
this);
decref_split(this);
}
- origin_decref(norigin);
+
blame_
origin_decref(norigin);
}
for (j = 0; j < num_ents; j++) {
}
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) {
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);
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);
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++)
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
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) {
if (!porigin)
continue;
if (!origin->previous) {
- origin_incref(porigin);
+
blame_
origin_incref(porigin);
origin->previous = porigin;
}
pass_blame_to_parent(sb, origin, porigin);
origin->previous = porigin;
}
pass_blame_to_parent(sb, origin, porigin);
@@
-1513,7
+1513,7
@@
static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
for (i = 0; i < num_sg; i++) {
if (sg_origin[i]) {
drop_origin_blob(sg_origin[i]);
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);
}
}
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.
*/
* 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) &&
parse_commit(commit);
if (reverse ||
(!(commit->object.flags & UNINTERESTING) &&
@@
-1794,7
+1794,7
@@
static void assign_blame(struct blame_scoreboard *sb, int opt)
break;
}
}
break;
}
}
- origin_decref(suspect);
+
blame_
origin_decref(suspect);
if (DEBUG) /* sanity */
sanity_check_refcnt(sb);
if (DEBUG) /* sanity */
sanity_check_refcnt(sb);
@@
-2857,13
+2857,13
@@
int cmd_blame(int argc, const char **argv, const char *prefix)
ent->suspect = o;
ent->s_lno = bottom;
ent->next = next;
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);
}
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);
range_set_release(&ranges);
string_list_clear(&range_list, 0);