mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-11 01:53:21 -05:00
When the caller knows upfront how many elements will be pushed onto a `strvec`, it is useful to pre-allocate enough space in the array to fit that many elements (and one additional slot to store NULL, indicating the end of the list.) Introduce `strvec_init_alloc()`, which allocates the backing array large enough to hold `alloc` elements and the termination marker without further reallocation. Reimplement `strvec_init()` as a special case of `strvec_init_alloc()`, namely when `alloc` is zero. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
3.5 KiB
3.5 KiB