]> git.ipfire.org Git - thirdparty/git.git/commit
reftable: stop using `BUG()` in trivial cases
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 09:20:43 +0000 (10:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 18:55:36 +0000 (10:55 -0800)
commit445f9f4f35c663fb668425f8c8fe0a1d58e1d8c7
tree9b3500077174934096236cfea832306cde914485
parent6f6127decde6785b9ba5f22a07a7754d1fda1a59
reftable: stop using `BUG()` in trivial cases

Stop using `BUG()` in the remaining trivial cases that we still have in
the reftable library. Instead of aborting the program, we'll now bubble
up a `REFTABLE_API_ERROR` to indicate misuse of the calling conventions.

Note that in both `reftable_reader_{inc,dec}ref()` we simply stop
calling `BUG()` altogether. The only situation where the counter should
be zero is when the structure has already been free'd anyway, so we
would run into undefined behaviour regardless of whether we try to abort
the program or not.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/iter.c
reftable/reader.c
reftable/writer.c