]> git.ipfire.org Git - thirdparty/git.git/commit - object-name.c
object-name: re-use "struct strbuf" in show_ambiguous_object()
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 27 Jan 2022 05:26:49 +0000 (06:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Jan 2022 20:09:34 +0000 (12:09 -0800)
commit3a73c1dfafcc53831a252fc3aededeb59be476f1
treec48120162da73dcb96b4a31afd0400ddd9a2ce6e
parentd2ef3cb7e29c35362125a61f1d96576c200076f6
object-name: re-use "struct strbuf" in show_ambiguous_object()

Reduce the allocations done by show_ambiguous_object() by moving the
"desc" strbuf into the "struct ambiguous_output" introduced in the
preceding commit.

This doesn't matter for optimization purposes, but since we're
accumulating a "struct strbuf advice" anyway let's follow that pattern
and add a "struct strbuf sb", we can then strbuf_reset() it rather
than calling strbuf_release() for each call to
show_ambiguous_object().

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-name.c