Thread (1 message) 1 message, 1 author, 2016-08-12

Re: [PATCH v12 11/13] bisect--helper: `bisect_next_check` & bisect_voc shell function in C

From: Junio C Hamano <hidden>
Date: 2016-08-12 18:11:16

Pranit Bauva [off-list ref] writes:
+static char *bisect_voc(char *revision_type)
+{
+	if (!strcmp(revision_type, "bad"))
+		return "bad|new";
+	if (!strcmp(revision_type, "good"))
+		return "good|old";
+
+	return NULL;
+}
I think you can return "const char *" from the above function.  Then
you do not have to do xstrdup() on the return values to store in
bad_syn and good_syn, and you do not have to free(3) them.
+static int bisect_next_check(const struct bisect_terms *terms,
+			     const char *current_term)
+{
+ ....
+		fprintf(stderr, N_("Warning: bisecting only with a %s commit\n"),
+			terms->term_bad.buf);
Hmph, is this N_() and not _()?
+ ....
+	}
+	bad_syn = xstrdup(bisect_voc("bad"));
+	good_syn = xstrdup(bisect_voc("good"));
+ ....
+	free(bad_syn);
+	free(good_syn);
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help