* [PATCH] string_list: use the right kind of STRING_LIST_INIT
@ 2022-07-21 1:02 Junio C Hamano
2022-07-21 3:28 ` Elijah Newren
2022-07-21 5:55 ` Ævar Arnfjörð Bjarmason
0 siblings, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2022-07-21 1:02 UTC (permalink / raw)
To: git
Since 4a4b4cda (builtin-remote: Make "remote -v" display push urls,
2009-06-13), the string_list that was initialized with 0 in its
strdup_string member is immediately made to strdup its key strings
by flipping the strdup_string member to true. When 183113a5
(string_list: Add STRING_LIST_INIT macro and make use of it.,
2010-07-04) has introduced STRING_LIST_INIT macros, it mechanically
replaced the initialization to STRING_LIST_INIT_NODUP.
Instead, just use the other initialization macro to make it strdup
the key from the beginning.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/remote.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git c/builtin/remote.c w/builtin/remote.c
index d9b8746cb3..c713463d89 100644
--- c/builtin/remote.c
+++ w/builtin/remote.c
@@ -1229,10 +1229,9 @@ static int get_one_entry(struct remote *remote, void *priv)
static int show_all(void)
{
- struct string_list list = STRING_LIST_INIT_NODUP;
+ struct string_list list = STRING_LIST_INIT_DUP;
int result;
- list.strdup_strings = 1;
result = for_each_remote(get_one_entry, &list);
if (!result) {
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] string_list: use the right kind of STRING_LIST_INIT
2022-07-21 1:02 [PATCH] string_list: use the right kind of STRING_LIST_INIT Junio C Hamano
@ 2022-07-21 3:28 ` Elijah Newren
2022-07-21 4:45 ` Junio C Hamano
2022-07-21 5:55 ` Ævar Arnfjörð Bjarmason
1 sibling, 1 reply; 5+ messages in thread
From: Elijah Newren @ 2022-07-21 3:28 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
On Wed, Jul 20, 2022 at 6:19 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Since 4a4b4cda (builtin-remote: Make "remote -v" display push urls,
> 2009-06-13), the string_list that was initialized with 0 in its
> strdup_string member is immediately made to strdup its key strings
> by flipping the strdup_string member to true. When 183113a5
> (string_list: Add STRING_LIST_INIT macro and make use of it.,
> 2010-07-04) has introduced STRING_LIST_INIT macros, it mechanically
> replaced the initialization to STRING_LIST_INIT_NODUP.
>
> Instead, just use the other initialization macro to make it strdup
> the key from the beginning.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> builtin/remote.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git c/builtin/remote.c w/builtin/remote.c
> index d9b8746cb3..c713463d89 100644
> --- c/builtin/remote.c
> +++ w/builtin/remote.c
> @@ -1229,10 +1229,9 @@ static int get_one_entry(struct remote *remote, void *priv)
>
> static int show_all(void)
> {
> - struct string_list list = STRING_LIST_INIT_NODUP;
> + struct string_list list = STRING_LIST_INIT_DUP;
> int result;
>
> - list.strdup_strings = 1;
> result = for_each_remote(get_one_entry, &list);
>
> if (!result) {
Makes sense, but shouldn't the subject have s/string-list:/remote:/ ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] string_list: use the right kind of STRING_LIST_INIT
2022-07-21 3:28 ` Elijah Newren
@ 2022-07-21 4:45 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2022-07-21 4:45 UTC (permalink / raw)
To: Elijah Newren; +Cc: Git Mailing List
Elijah Newren <newren@gmail.com> writes:
> Makes sense, but shouldn't the subject have s/string-list:/remote:/ ?
Oh, you are absolutely right.
I was influenced by 183113a5 (string_list: Add STRING_LIST_INIT
macro and make use of it., 2010-07-04), which I was staring at too
much while thinking that this fix was finishing up what it started.
Will amend. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] string_list: use the right kind of STRING_LIST_INIT
2022-07-21 1:02 [PATCH] string_list: use the right kind of STRING_LIST_INIT Junio C Hamano
2022-07-21 3:28 ` Elijah Newren
@ 2022-07-21 5:55 ` Ævar Arnfjörð Bjarmason
2022-07-25 19:01 ` Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2022-07-21 5:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, Jul 20 2022, Junio C Hamano wrote:
> Since 4a4b4cda (builtin-remote: Make "remote -v" display push urls,
> 2009-06-13), the string_list that was initialized with 0 in its
> strdup_string member is immediately made to strdup its key strings
> by flipping the strdup_string member to true. When 183113a5
> (string_list: Add STRING_LIST_INIT macro and make use of it.,
> 2010-07-04) has introduced STRING_LIST_INIT macros, it mechanically
> replaced the initialization to STRING_LIST_INIT_NODUP.
>
> Instead, just use the other initialization macro to make it strdup
> the key from the beginning.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> builtin/remote.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git c/builtin/remote.c w/builtin/remote.c
> index d9b8746cb3..c713463d89 100644
> --- c/builtin/remote.c
> +++ w/builtin/remote.c
> @@ -1229,10 +1229,9 @@ static int get_one_entry(struct remote *remote, void *priv)
>
> static int show_all(void)
> {
> - struct string_list list = STRING_LIST_INIT_NODUP;
> + struct string_list list = STRING_LIST_INIT_DUP;
> int result;
>
> - list.strdup_strings = 1;
> result = for_each_remote(get_one_entry, &list);
>
> if (!result) {
Heh :) I think it's safe to give this my Reviewed-By, since I've been
running with this patch for almost a year now:
https://github.com/avar/git/commit/bdf4466eb92
It's on a branch of some WIP string_list API fixes that I haven't sent
in, but the fix looks good to me...
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] string_list: use the right kind of STRING_LIST_INIT
2022-07-21 5:55 ` Ævar Arnfjörð Bjarmason
@ 2022-07-25 19:01 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2022-07-25 19:01 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason; +Cc: git
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> Heh :) I think it's safe to give this my Reviewed-By, since I've been
> running with this patch for almost a year now:
> https://github.com/avar/git/commit/bdf4466eb92
>
> It's on a branch of some WIP string_list API fixes that I haven't sent
> in, but the fix looks good to me...
I do not think it is all that urgent, but I do not think it is worth
wasting our braincells to remember that a WIP series is waiting to
touch and update this area again, so I'll merge this single patch
down to 'next' and 'master' soonish.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-25 19:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-21 1:02 [PATCH] string_list: use the right kind of STRING_LIST_INIT Junio C Hamano
2022-07-21 3:28 ` Elijah Newren
2022-07-21 4:45 ` Junio C Hamano
2022-07-21 5:55 ` Ævar Arnfjörð Bjarmason
2022-07-25 19:01 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.