]> git.ipfire.org Git - thirdparty/git.git/commit
t-reftable-block: use block_iter_reset() instead of block_iter_close()
authorChandra Pratap <chandrapratap3519@gmail.com>
Wed, 21 Aug 2024 12:30:56 +0000 (18:00 +0530)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Aug 2024 16:41:41 +0000 (09:41 -0700)
commit31216ee28a452d39d9fba6cd72d8b072eab50af1
tree5c004e2f61323bf96cf4d6b55c5e93a69941cb98
parentc25cbcd352c5831a1270b57104ecb6c0e6789a0c
t-reftable-block: use block_iter_reset() instead of block_iter_close()

block_iter_reset() restores a block iterator to its state at the time
of initialization without freeing any memory while block_iter_close()
deallocates the memory for the iterator.

In the current testing setup, a block iterator is allocated and
deallocated for every iteration of a loop, which hurts performance.
Improve upon this by using block_iter_reset() at the start of each
iteration instead. This has the added benifit of testing
block_iter_reset(), which currently remains untested.

Similarly, remove reftable_record_release() for a reftable record
that is still in use.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-reftable-block.c