Thread (63 messages) 63 messages, 5 authors, 2024-10-18

Re: [PATCH v2 03/10] reftable/basics: provide new `reftable_buf` interface

From: Taylor Blau <hidden>
Date: 2024-10-14 22:34:57

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
*?

Thanks,
Taylor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help