On Mon, Oct 14, 2024 at 06:34:55PM -0400, Taylor Blau wrote: > On Mon, Oct 14, 2024 at 03:02:24PM +0200, Patrick Steinhardt wrote: > > 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/. > > > +/* > > + * 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 > *? Only that it emulates `strbuf_add()`, which also uses a void pointer. Patrick