[PATCH v2 5/7] bisect: change read_bisect_terms parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Louis Stuber <stuberl@xxxxxxxxxxxxxxxxxxxxxxx>

The function reads BISECT_TERMS and stores it at the adress given in
parameters (instead of global variables name_bad and name_good).

This allows to use the function outside bisect.c.

Signed-off-by: Antoine Delaite <antoine.delaite@xxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Louis Stuber <stuberl@xxxxxxxxxxxxxxxxxxxxxxx>
---
 bisect.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/bisect.c b/bisect.c
index eaa85b6..7afd335 100644
--- a/bisect.c
+++ b/bisect.c
@@ -908,12 +908,11 @@ static void show_diff_tree(const char *prefix, struct commit *commit)
 }
 
 /*
- * The terms used for this bisect session are stored in
- * BISECT_TERMS: it can be bad/good or new/old.
- * We read them and store them to adapt the messages
- * accordingly. Default is bad/good.
+ * The terms used for this bisect session are stored in BISECT_TERMS.
+ * We read them and store them to adapt the messages accordingly.
+ * Default is bad/good.
  */
-void read_bisect_terms(void)
+void read_bisect_terms(const char **read_bad, const char **read_good)
 {
 	struct strbuf str = STRBUF_INIT;
 	const char *filename = git_path("BISECT_TERMS");
@@ -924,9 +923,9 @@ void read_bisect_terms(void)
 			strerror(errno));
 	} else {
 		strbuf_getline(&str, fp, '\n');
-		name_bad = strbuf_detach(&str, NULL);
+		*read_bad = strbuf_detach(&str, NULL);
 		strbuf_getline(&str, fp, '\n');
-		name_good = strbuf_detach(&str, NULL);
+		*read_good = strbuf_detach(&str, NULL);
 	}
 	strbuf_release(&str);
 	fclose(fp);
@@ -948,7 +947,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
 	const unsigned char *bisect_rev;
 	char bisect_rev_hex[GIT_SHA1_HEXSZ + 1];
 
-	read_bisect_terms();
+	read_bisect_terms(&name_bad, &name_good);
 	if (read_bisect_refs())
 		die("reading bisect refs failed");
 
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]