]> git.ipfire.org Git - thirdparty/git.git/commit
bisect: simplify string_list memory handling
authorJeff King <peff@peff.net>
Thu, 19 Feb 2026 07:57:52 +0000 (08:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 19 Feb 2026 18:41:18 +0000 (10:41 -0800)
commit6375a00ef16071eadbb383bd9915e277ef304bfe
tree7516ef49d564cdd0b72d29a7ceb2c777a5b1c736
parent9e86e1a05b032d712658bbe70231447455f83fb6
bisect: simplify string_list memory handling

We declare the refs_for_removal string_list as NODUP, forcing us to
manually allocate strings we insert. And then when it comes time to
clean up, we set strdup_strings so that string_list_clear() will free
them for us.

This is a confusing pattern, and can be done much more simply by just
declaring the list with the DUP initializer in the first place.

It was written this way originally because one of the callsites
generated the item using xstrfmt(). But that spot switched to a plain
xstrdup() in the preceding commit. That means we can now just let the
string_list code handle allocation itself.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c