Re: [PATCH v2 03/10] reftable/basics: provide new `reftable_buf` interface
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Oct 14, 2024, 22:34 UTC
- Message-ID
- <Zw2cjxpDf6MowCP+@nand.local>
- In-Reply-To
- <0ddc8c0c896a006e4cc094390125efcec0b3cdff.1728910727.git.ps@pks.im>
On Mon, Oct 14, 2024 at 03:02:24PM +0200, Patrick Steinhardt wrote:
Show 15 quoted lines
> 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 `refatble_set_alloc()`.
s/refatble/reftable/.
Show 5 quoted lines
> +/* > + * Add the given bytes to the buffer. Returns 0 on success, > + * REFTABLE_OUT_OF_MEMORY_ERROR on allocation failure. > + */ > +int reftable_buf_add(struct reftable_buf *buf, const void *data, size_t len);
Is there a reason that data is a void-pointer here and not a const char *?
Thanks, Taylor