diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-07-02 11:57:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-07-06 12:10:17 -0700 |
commit | 10b635b77311badcbb5045b7421e6826c4536613 (patch) | |
tree | 82fda8f84620a0dfc3c48770430194f848ca92e0 /t/t4018/php-final-class | |
parent | bundle.c: use a temporary variable for OIDs and names (diff) | |
download | tgif-10b635b77311badcbb5045b7421e6826c4536613.tar.xz |
bundle: remove "ref_list" in favor of string-list.c API
Move away from the "struct ref_list" in bundle.c in favor of the
almost identical string-list.c API.
That API fits this use-case perfectly, but did not exist in its
current form when this code was added in 2e0afafebd (Add git-bundle:
move objects and references by archive, 2007-02-22), with hindsight we
could have used the path-list API, which later got renamed to
string-list. See 8fd2cb4069 (Extract helper bits from
c-merge-recursive work, 2006-07-25)
We need to change "name" to "string" and "oid" to "util" to make this
conversion, but other than that the APIs are pretty much identical for
what bundle.c made use of.
Let's also replace the memset(..,0,...) pattern with a more idiomatic
"INIT" macro, and finally add a *_release() function so to free the
allocated memory.
Before this the add_to_ref_list() would leak memory, now e.g. "bundle
list-heads" reports no memory leaks at all under valgrind.
In the bundle_header_init() function we're using a clever trick to
memcpy() what we'd get from the corresponding
BUNDLE_HEADER_INIT. There is a concurrent series to make use of that
pattern more generally, see [1].
1. https://lore.kernel.org/git/cover-0.5-00000000000-20210701T104855Z-avarab@gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4018/php-final-class')
0 files changed, 0 insertions, 0 deletions