]> git.ipfire.org Git - thirdparty/git.git/commit
reftable/basics: provide new `reftable_buf` interface
authorPatrick Steinhardt <ps@pks.im>
Thu, 17 Oct 2024 04:53:50 +0000 (06:53 +0200)
committerTaylor Blau <me@ttaylorr.com>
Thu, 17 Oct 2024 20:59:55 +0000 (16:59 -0400)
commit81eddda540eae43ef481b629d7f4d8023ea40c57
tree576098c42ea01e40540ea9076c1ff02b004c4ec3
parent7fa7e14ebee9d82545bb4a8dcc1cac22ef51cfed
reftable/basics: provide new `reftable_buf` interface

Implement a new `reftable_buf` interface that will replace Git's own
`strbuf` interface. This is done due to three reasons:

  - The `strbuf` interfaces do not handle memory allocation failures and
    instead causes us to die. This is okay in the context of Git, but is
    not in the context of the reftable library, which is supposed to be
    usable by third-party applications.

  - The `strbuf` interface is quite deeply tied into Git, which makes it
    hard to use the reftable library as a standalone library. Any
    dependent would have to carefully extract the relevant parts of it
    to make things work, which is not all that sensible.

  - The `strbuf` interface does not use the pluggable allocators that
    can be set up via `reftable_set_alloc()`.

So we have good reasons to use our own type, and the implementation is
rather trivial. Implement our own type. Conversion of the reftable
library will be handled in subsequent commits.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
reftable/basics.c
reftable/basics.h