git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [Outreachy] [PATCH] bisect--helper: convert `*_warning` char pointers to char arrays.
@ 2019-12-13 11:52 Miriam Rubio
  2019-12-13 19:57 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Miriam Rubio @ 2019-12-13 11:52 UTC (permalink / raw)
  To: git; +Cc: Tanushree Tumane, Christian Couder, Miriam Rubio

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.

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.");
-- 
2.21.0 (Apple Git-122.2)


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Outreachy] [PATCH] bisect--helper: convert `*_warning` char pointers to char arrays.
  2019-12-13 11:52 [Outreachy] [PATCH] bisect--helper: convert `*_warning` char pointers to char arrays Miriam Rubio
@ 2019-12-13 19:57 ` Junio C Hamano
  2019-12-14  8:09   ` Miriam R.
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2019-12-13 19:57 UTC (permalink / raw)
  To: Miriam Rubio; +Cc: git, Tanushree Tumane, Christian Couder

Miriam Rubio <mirucam@gmail.com> writes:

> 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.

> 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.");

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Outreachy] [PATCH] bisect--helper: convert `*_warning` char pointers to char arrays.
  2019-12-13 19:57 ` Junio C Hamano
@ 2019-12-14  8:09   ` Miriam R.
  0 siblings, 0 replies; 3+ messages in thread
From: Miriam R. @ 2019-12-14  8:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Tanushree Tumane, Christian Couder

El vie., 13 dic. 2019 a las 20:57, Junio C Hamano
(<gitster@pobox.com>) escribió:
>
> Miriam Rubio <mirucam@gmail.com> writes:
>
> > 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.

Ok, thank you, Junio. I'll send another version with the changes.

>
> > 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.");

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-14  8:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 11:52 [Outreachy] [PATCH] bisect--helper: convert `*_warning` char pointers to char arrays Miriam Rubio
2019-12-13 19:57 ` Junio C Hamano
2019-12-14  8:09   ` Miriam R.

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).