Re: [Outreachy][PATCH 1/2] strbuf: introduce strbuf_addstrings() to repeatedly add a string
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 26, 2024, 18:10 UTC
- Message-ID
- <xmqq7cirnlkg.fsf@gitster.g>
- In-Reply-To
- <CAP8UFD0Qhy78=v9+hCekMJPkcH2KmeZeQ0xUx8kqrByQ4PO3Xg@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
> Unfortunately strbuf_add() calls strbuf_grow() itself which is not > needed as we have already called strbuf_grow() to avoid repeated > reallocation.
Why is it unfortunate? If the current allocation is sufficient, it is a cheap no-op, isn't it (if not, we should make it so)?