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

Re: [Outreachy] [PATCH] bisect--helper: convert `*_warning` char pointers to char arrays.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 13, 2019, 19:57 UTC
Message-ID
<xmqqblscj8w9.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191213115225.13291-1-mirucam@gmail.com>
Miriam Rubio <mirucam@gmail.com> writes:
Show 6 quoted lines
> From: Tanushree Tumane <tanushreetumane@gmail.com>
>
> A char array creates a character array. Its size is the number
> of elements plus one (compiler automatically adds '\0').
> A char pointer creates a char array and a pointer to that char
> array that means four extra for bytes for the pointer variable.

This depends on the word size of your pointer and many people have 8-byte pointers these days. Just say

	Instead of using a pointer that points at a constant string,
	just give name directly to the constant string; this way, we
	do not have to allocate a pointer variable in addition to
	the string we want to use.
or something.
Show 32 quoted lines
> Let's convert `need_bad_and_good_revision_warning` and
> `need_bisect_start_warning` char pointers to char arrays.
>
> Mentored-by: Christian Couder <chriscool@tuxfamily.org>
> Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
> Signed-off-by: Miriam Rubio <mirucam@gmail.com>
> ---
> This patch is a new version of:
> https://public-inbox.org/git/cadc46442d5c960caa58227092289fa2f44fb96f.1551003074.git.gitgitgadget@gmail.com/
> sent previously by Tanushree.
>
>  builtin/bisect--helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
> index 3055b2bb50..1718df7f09 100644
> --- a/builtin/bisect--helper.c
> +++ b/builtin/bisect--helper.c
> @@ -282,11 +282,11 @@ static int mark_good(const char *refname, const struct object_id *oid,
>  	return 1;
>  }
>  
> -static const char *need_bad_and_good_revision_warning =
> +static const char need_bad_and_good_revision_warning[] =
>  	N_("You need to give me at least one %s and %s revision.\n"
>  	   "You can use \"git bisect %s\" and \"git bisect %s\" for that.");
>  
> -static const char *need_bisect_start_warning =
> +static const char need_bisect_start_warning[] =
>  	N_("You need to start by \"git bisect start\".\n"
>  	   "You then need to give me at least one %s and %s revision.\n"
>  	   "You can use \"git bisect %s\" and \"git bisect %s\" for that.");
Previous: Miriam RubioNext: Miriam R.
Message 2 of 3 in “bisect--helper: convert `*_warning` char pointers to char arrays.”
  1. Miriam RubioDec 13, 2019
  2. Junio C HamanoDec 13, 2019
  3. Miriam R.Dec 14, 2019

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.