From: "René Scharfe" <l.s.r@web•de>
To: Junio C Hamano <gitster@pobox•com>
Cc: Git List <git@vger•kernel.org>
Subject: Re: [PATCH] use strvec_pushv() to add another strvec
Date: Fri, 20 Mar 2026 01:46:21 +0100 [thread overview]
Message-ID: <6c16da38-654d-4959-b0d9-3fff3d96d036@web.de> (raw)
In-Reply-To: <xmqqwlz7iks3.fsf@gitster.g>
On 3/19/26 10:14 PM, Junio C Hamano wrote:
> René Scharfe <l.s.r@web•de> writes:
>
>> Simplify the code by letting strvec_pushv() add the items of a second
>> strvec instead of pushing them one by one.
>>
>> Signed-off-by: René Scharfe <l.s.r@web•de>
>> ---
>> fetch-pack.c | 8 ++------
>> git.c | 3 +--
>> submodule.c | 4 +---
>> 3 files changed, 4 insertions(+), 11 deletions(-)
>
> Nice. Is this something we can make a coccinelle rule for?
>
> Something like
>
> @@
> struct strvec SRC;
> struct strvec DST;
> size_t I;
> @@
> - for (size_t I = 0; I < SRC.nr; I++)
> - strvec_push(&DST, SRC.v[I]);
> + strvec_pushv(&DST, SRC.v);
>
> perhaps?
We can. Should we? It does find a fourth case from the 18th batch that
has landed a few hours ago, at least. Will send as v2.
René
next prev parent reply other threads:[~2026-03-20 0:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 20:49 [PATCH] use strvec_pushv() to add another strvec René Scharfe
2026-03-19 21:14 ` Junio C Hamano
2026-03-20 0:46 ` René Scharfe [this message]
2026-03-20 0:46 ` [PATCH v2] " René Scharfe
2026-03-22 18:05 ` Junio C Hamano
2026-03-27 23:07 ` René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c16da38-654d-4959-b0d9-3fff3d96d036@web.de \
--to=l.s.r@web$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox