]> git.ipfire.org Git - thirdparty/git.git/commit
strvec: declare the `strvec_push_nodup()` function globally
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 13 Jul 2024 21:08:19 +0000 (21:08 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 13 Jul 2024 23:23:36 +0000 (16:23 -0700)
commitce68178a0ae222b71fe5f89f05dc7113267c079b
tree375b67d03cd841b318b06e9cce2894d72329d931
parent0593c1ea30737cf2d61f7c191d3687b37badf3be
strvec: declare the `strvec_push_nodup()` function globally

This function differs from `strvec_push()` in that it takes ownership of
the allocated string that is passed as second argument.

This is useful when appending elements to the string array that have
been freshly allocated and serve no further other purpose after that.

Without declaring this function globally, call sites would allocate the
memory, only to have `strvec_push()` duplicate the string, and then the
first copy would need to be released. Having this function globally
avoids that kind of unnecessary work.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
strvec.c
strvec.h