git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff Smith <whydoubt@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, peff@peff.net, Jeff Smith <whydoubt@gmail.com>
Subject: [PATCH 06/29] blame: rename origin-related functions
Date: Wed, 24 May 2017 00:15:14 -0500	[thread overview]
Message-ID: <20170524051537.29978-7-whydoubt@gmail.com> (raw)
In-Reply-To: <20170524051537.29978-1-whydoubt@gmail.com>

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>
---
 builtin/blame.c | 58 ++++++++++++++++++++++++++++-----------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 717868e..7854770 100644
--- 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.
  */
-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 @@ 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]);
-			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 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
 		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);
-- 
2.9.3


  parent reply	other threads:[~2017-05-24  5:16 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  5:15 [PATCH 00/29] Add blame to libgit Jeff Smith
2017-05-24  5:15 ` [PATCH 01/29] blame: remove unneeded dependency on blob.h Jeff Smith
2017-05-24  5:15 ` [PATCH 02/29] blame: move textconv_object with related functions Jeff Smith
2017-05-24  5:15 ` [PATCH 03/29] blame: remove unused parameters Jeff Smith
2017-05-24  5:15 ` [PATCH 04/29] blame: rename origin structure to blame_origin Jeff Smith
2017-05-24  5:15 ` [PATCH 05/29] blame: rename scoreboard structure to blame_scoreboard Jeff Smith
2017-05-24  5:15 ` Jeff Smith [this message]
2017-05-24  5:15 ` [PATCH 07/29] blame: rename coalesce function Jeff Smith
2017-05-24  5:15 ` [PATCH 08/29] blame: rename ent_score function Jeff Smith
2017-05-24  5:15 ` [PATCH 09/29] blame: rename nth_line function Jeff Smith
2017-05-24  5:15 ` [PATCH 10/29] blame: move stat counters to scoreboard Jeff Smith
2017-05-24  5:15 ` [PATCH 11/29] blame: move copy/move thresholds " Jeff Smith
2017-05-24  5:15 ` [PATCH 12/29] blame: move contents_from " Jeff Smith
2017-05-24  5:15 ` [PATCH 13/29] blame: move reverse flag " Jeff Smith
2017-05-24  5:15 ` [PATCH 14/29] blame: move show_root " Jeff Smith
2017-05-24  5:15 ` [PATCH 15/29] blame: move xdl_opts flags " Jeff Smith
2017-05-24  5:15 ` [PATCH 16/29] blame: move no_whole_file_rename flag " Jeff Smith
2017-05-24  5:15 ` [PATCH 17/29] blame: make sanity_check use a callback in scoreboard Jeff Smith
2017-05-24  5:15 ` [PATCH 18/29] blame: move progess updates to a scoreboard callback Jeff Smith
2017-05-25  4:16   ` Junio C Hamano
2017-05-24  5:15 ` [PATCH 19/29] blame: wrap blame_sort and compare_blame_final Jeff Smith
2017-05-24  5:15 ` [PATCH 20/29] blame: rework methods that determine 'final' commit Jeff Smith
2017-05-25  4:59   ` Junio C Hamano
2017-05-24  5:15 ` [PATCH 21/29] blame: create scoreboard init function Jeff Smith
2017-05-24  5:15 ` [PATCH 22/29] blame: create scoreboard setup function Jeff Smith
2017-05-25  5:15   ` Junio C Hamano
2017-05-24  5:15 ` [PATCH 23/29] blame: create entry prepend function Jeff Smith
2017-05-25  5:21   ` Junio C Hamano
2017-05-24  5:15 ` [PATCH 24/29] blame: move core structures to header Jeff Smith
2017-05-25  5:25   ` Junio C Hamano
2017-05-24  5:15 ` [PATCH 25/29] blame: move origin-related methods to libgit Jeff Smith
2017-05-24  5:15 ` [PATCH 26/29] blame: move fake-commit-related " Jeff Smith
2017-05-24  5:15 ` [PATCH 27/29] blame: move scoreboard-related " Jeff Smith
2017-05-24  5:15 ` [PATCH 28/29] blame: move scoreboard setup " Jeff Smith
2017-05-25  5:53   ` Junio C Hamano
2017-05-25 12:56     ` Jeffrey Smith
2017-05-24  5:15 ` [PATCH 29/29] blame: move entry prepend " Jeff Smith
2017-05-24  7:08 ` [PATCH 00/29] Add blame " Junio C Hamano
2017-05-25  5:55 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170524051537.29978-7-whydoubt@gmail.com \
    --to=whydoubt@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).