bisect--helper: convert `*_warning` char pointers to char arrays.
PATCH 1/1 bisect--helper: convert `*_warning` char pointers to char arrays.
From: Tanushree Tumane <[email protected]>
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.
---
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(-)
builtin/bisect--helper.c +2 -2
@@ -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." );
Signature · 1 line
2.21.0 (Apple Git-122.2)
Quoted 6 lines · Miriam Rubio
From: Tanushree Tumane <[email protected]>
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.
Quoted 32 lines
Let's convert
need_bad_and_good_revision_warningandneed_bisect_start_warningchar pointers to char arrays.Mentored-by Christian Couder <[email protected]>Signed-off-by Tanushree Tumane <[email protected]>Signed-off-by Miriam Rubio <[email protected]>---
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(-)builtin/bisect--helper.c +2
-2@@ -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." );
Quoted 13 lines · Junio C Hamano
Quoted 6 lines · Miriam Rubio
From: Tanushree Tumane <[email protected]>
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
Quoted 6 lines
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.
Quoted 33 lines
Quoted 33 lines
Let's convert
need_bad_and_good_revision_warningandneed_bisect_start_warningchar pointers to char arrays.Mentored-by Christian Couder <[email protected]>Signed-off-by Tanushree Tumane <[email protected]>Signed-off-by Miriam Rubio <[email protected]>---
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(-)builtin/bisect--helper.c +2
-2@@ -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." );