Re: [PATCH] use strvec_pushv() to add another strvec
- From
René Scharfe <l.s.r@web.de>
- Date
- Mar 20, 2026, 00:46 UTC
- Message-ID
- <6c16da38-654d-4959-b0d9-3fff3d96d036@web.de>
- In-Reply-To
- <xmqqwlz7iks3.fsf@gitster.g>
On 3/19/26 10:14 PM, Junio C Hamano wrote:
Show 26 quoted lines
> 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é