Re: [PATCH 12/13] strvec: implement swapping two strvecs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 27, 2024, 21:22 UTC
- Message-ID
- <xmqqbk6z1iba.fsf@gitster.g>
- In-Reply-To
- <ZgPSpYVSSmQ9Muec@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
>> +
>> +void strvec_swap(struct strvec *a, struct strvec *b)
>> +{
>> + struct strvec t = *a;
>> + *a = *b;
>> + *b = t;
>> +}
>
> Isn't this equivalent to `SWAP(*a, *b)`?Yes. "make coccicheck" does flag this one.
Let's drop this step, and tweak the 13/13 patch to make its sole caller directly use SWAP() instead, perhaps like so:
credential.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git c/credential.c w/credential.c index 9a08efe113..5ea52ddd68 100644 --- c/credential.c +++ w/credential.c @@ -39,7 +39,7 @@ void credential_clear(struct credential *c) void credential_next_state(struct credential *c) { strvec_clear(&c->state_headers_to_send); - strvec_swap(&c->state_headers, &c->state_headers_to_send); + SWAP(c->state_headers, c->state_headers_to_send); } void credential_clear_secrets(struct credential *c)