git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 12, 2016, 18:11 UTC
Message-ID
<xmqq1t1tyi0z.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<010201567675ae68-15d79b9a-83fc-44ee-8607-07c2d0191c59-000000@eu-west-1.amazonses.com>
Pranit Bauva <pranit.bauva@gmail.com> writes:
Show 9 quoted lines
> +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.

Show 6 quoted lines
> +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 _()?
Show 7 quoted lines
> + ....
> +	}
> +	bad_syn = xstrdup(bisect_voc("bad"));
> +	good_syn = xstrdup(bisect_voc("good"));
> + ....
> +	free(bad_syn);
> +	free(good_syn);
Previous: Pranit BauvaNext: Junio C Hamano
Message 19 of 22 in “bisect--helper: use OPT_CMDMODE instead of OPT_BOOL”
  1. 01/13 bisect--helper: use OPT_CMDMODE instead of OPT_BOOLPranit Bauva, Aug 10, 2016
  2. 10/13 bisect--helper: `check_and_set_terms` shell function in CPranit Bauva, Aug 10, 2016
  3. 03/13 bisect--helper: `write_terms` shell function in CPranit Bauva, Aug 10, 2016
  4. 07/13 bisect--helper: `bisect_reset` shell function in CPranit Bauva, Aug 10, 2016
  5. 02/13 bisect: rewrite `check_term_format` shell function in CPranit Bauva, Aug 10, 2016
  6. 13/13 bisect--helper: `bisect_start` shell function partially in CPranit Bauva, Aug 10, 2016
  7. Junio C HamanoAug 12, 2016
  8. Pranit BauvaAug 13, 2016
  9. Christian CouderAug 13, 2016
  10. Pranit BauvaAug 13, 2016
  11. 12/13 bisect--helper: `get_terms` & `bisect_terms` shell function in CPranit Bauva, Aug 10, 2016
  12. 04/13 bisect--helper: `bisect_clean_state` shell function in CPranit Bauva, Aug 10, 2016
  13. Junio C HamanoAug 12, 2016
  14. 08/13 bisect--helper: `is_expected_rev` & `check_expected_revs` shell function in CPranit Bauva, Aug 10, 2016
  15. 05/13 t6030: explicitly test for bisection cleanupPranit Bauva, Aug 10, 2016
  16. Pranit BauvaAug 10, 2016
  17. 09/13 bisect--helper: `bisect_write` shell function in CPranit Bauva, Aug 10, 2016
  18. 11/13 bisect--helper: `bisect_next_check` & bisect_voc shell function in CPranit Bauva, Aug 10, 2016
  19. Junio C HamanoAug 12, 2016
  20. Junio C HamanoAug 12, 2016
  21. Pranit BauvaAug 13, 2016
  22. 06/13 wrapper: move is_empty_file() and rename it as is_empty_or_missing_file()Pranit Bauva, Aug 10, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.