From: Taylor Blau <me@ttaylorr.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Eric Sunshine <sunshine@sunshineco.com>,
git@vger.kernel.org, Edward Thomson <ethomson@edwardthomson.com>,
karthik nayak <karthik.188@gmail.com>
Subject: Re: [PATCH v2 03/10] reftable/basics: provide new `reftable_buf` interface
Date: Wed, 16 Oct 2024 16:56:52 -0400 [thread overview]
Message-ID: <ZxAolGGcndQzApPJ@nand.local> (raw)
In-Reply-To: <Zw98hKZc1pjBGGcU@pks.im>
On Wed, Oct 16, 2024 at 10:42:44AM +0200, Patrick Steinhardt wrote:
> On Tue, Oct 15, 2024 at 03:27:29PM -0400, Taylor Blau wrote:
> > On Tue, Oct 15, 2024 at 01:10:59AM -0400, Eric Sunshine wrote:
> > > On Tue, Oct 15, 2024 at 12:38 AM Patrick Steinhardt <ps@pks.im> wrote:
> > > > 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:
> > > > > > +/*
> > > > > > + * 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.
> > >
> > > The reason for that is because strbuf is a generic byte-array which
> > > may contain embedded NULs, and the `const void *` plus `len`
> > > emphasizes this property, whereas `const char *` would imply a
> > > C-string with no embedded NULs.
> >
> > Thanks, that was the explanation I was missing. Perhaps it is worth
> > re-stating in the commit message here to avoid confusing readers like I
> > was when I first read Patrick's patch ;-).
>
> Does it make sense to explicitly state how the interfaces look like
> though? I don't do that for the other functions either, and for most of
> the part I just reuse the exact same function arguments as we had with
> the strbuf interface.
I don't feel very strongly about it, but I had suggested it because my
initial read of this patch confused me, and I had wondered if others may
be similarly confused.
For what it's worth, I was thinking something on the order of the
following added to the patch message:
Note that the reftable_buf_add() function intentionally takes a "const
void *" instead of a "const char *" (as does its strbuf counterpart,
strbuf_add()) to emphasize that the buffer may contain NUL characters.
But, as I said, I don't feel very strongly about it.
Thanks,
Taylor
next prev parent reply other threads:[~2024-10-16 20:56 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 6:54 [PATCH 00/10] reftable: stop using `struct strbuf` Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 01/10] reftable: stop using `strbuf_addbuf()` Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 02/10] reftable: stop using `strbuf_addf()` Patrick Steinhardt
2024-10-11 9:51 ` karthik nayak
2024-10-14 13:09 ` Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 03/10] reftable/basics: provide new `reftable_buf` interface Patrick Steinhardt
2024-10-11 10:03 ` karthik nayak
2024-10-14 13:09 ` Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 04/10] reftable: convert from `strbuf` to `reftable_buf` Patrick Steinhardt
2024-10-11 12:12 ` karthik nayak
2024-10-14 13:09 ` Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 05/10] reftable/blocksource: adapt interface name Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 06/10] t/unit-tests: check for `reftable_buf` allocation errors Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 07/10] reftable/stack: adapt `format_name()` to handle allocation failures Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 08/10] reftable/record: adapt `reftable_record_key()` " Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 09/10] reftable/stack: adapt `stack_filename()` " Patrick Steinhardt
2024-10-11 6:54 ` [PATCH 10/10] reftable: handle trivial `reftable_buf` errors Patrick Steinhardt
2024-10-11 12:18 ` [PATCH 00/10] reftable: stop using `struct strbuf` karthik nayak
2024-10-14 13:09 ` Patrick Steinhardt
2024-10-14 13:02 ` [PATCH v2 " Patrick Steinhardt
2024-10-14 13:02 ` [PATCH v2 01/10] reftable: stop using `strbuf_addbuf()` Patrick Steinhardt
2024-10-14 22:19 ` Taylor Blau
2024-10-14 13:02 ` [PATCH v2 02/10] reftable: stop using `strbuf_addf()` Patrick Steinhardt
2024-10-14 22:32 ` Taylor Blau
2024-10-15 4:37 ` Patrick Steinhardt
2024-10-15 19:26 ` Taylor Blau
2024-10-14 13:02 ` [PATCH v2 03/10] reftable/basics: provide new `reftable_buf` interface Patrick Steinhardt
2024-10-14 22:34 ` Taylor Blau
2024-10-15 4:38 ` Patrick Steinhardt
2024-10-15 5:10 ` Eric Sunshine
2024-10-15 19:27 ` Taylor Blau
2024-10-16 8:42 ` Patrick Steinhardt
2024-10-16 20:56 ` Taylor Blau [this message]
2024-10-17 4:54 ` Patrick Steinhardt
2024-10-17 20:59 ` Taylor Blau
2024-10-14 13:02 ` [PATCH v2 04/10] reftable: convert from `strbuf` to `reftable_buf` Patrick Steinhardt
2024-10-14 22:35 ` Taylor Blau
2024-10-14 13:02 ` [PATCH v2 05/10] reftable/blocksource: adapt interface name Patrick Steinhardt
2024-10-14 13:02 ` [PATCH v2 06/10] t/unit-tests: check for `reftable_buf` allocation errors Patrick Steinhardt
2024-10-14 13:02 ` [PATCH v2 07/10] reftable/stack: adapt `format_name()` to handle allocation failures Patrick Steinhardt
2024-10-14 22:41 ` Taylor Blau
2024-10-14 13:02 ` [PATCH v2 08/10] reftable/record: adapt `reftable_record_key()` " Patrick Steinhardt
2024-10-14 13:02 ` [PATCH v2 09/10] reftable/stack: adapt `stack_filename()` " Patrick Steinhardt
2024-10-14 13:02 ` [PATCH v2 10/10] reftable: handle trivial `reftable_buf` errors Patrick Steinhardt
2024-10-14 22:44 ` [PATCH v2 00/10] reftable: stop using `struct strbuf` Taylor Blau
2024-10-15 4:37 ` Patrick Steinhardt
2024-10-15 10:33 ` shejialuo
2024-10-15 10:44 ` Patrick Steinhardt
2024-10-15 11:23 ` shejialuo
2024-10-17 4:53 ` [PATCH v3 " Patrick Steinhardt
2024-10-17 4:53 ` [PATCH v3 01/10] reftable: stop using `strbuf_addbuf()` Patrick Steinhardt
2024-10-17 4:53 ` [PATCH v3 02/10] reftable: stop using `strbuf_addf()` Patrick Steinhardt
2024-10-17 4:53 ` [PATCH v3 03/10] reftable/basics: provide new `reftable_buf` interface Patrick Steinhardt
2024-10-17 4:53 ` [PATCH v3 04/10] reftable: convert from `strbuf` to `reftable_buf` Patrick Steinhardt
2024-10-17 4:53 ` [PATCH v3 05/10] reftable/blocksource: adapt interface name Patrick Steinhardt
2024-10-17 4:54 ` [PATCH v3 06/10] t/unit-tests: check for `reftable_buf` allocation errors Patrick Steinhardt
2024-10-17 4:54 ` [PATCH v3 07/10] reftable/stack: adapt `format_name()` to handle allocation failures Patrick Steinhardt
2024-10-17 4:54 ` [PATCH v3 08/10] reftable/record: adapt `reftable_record_key()` " Patrick Steinhardt
2024-10-17 4:54 ` [PATCH v3 09/10] reftable/stack: adapt `stack_filename()` " Patrick Steinhardt
2024-10-17 4:54 ` [PATCH v3 10/10] reftable: handle trivial `reftable_buf` errors Patrick Steinhardt
2024-10-17 21:00 ` [PATCH v3 00/10] reftable: stop using `struct strbuf` Taylor Blau
2024-10-18 7:46 ` karthik nayak
2024-10-18 21:41 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZxAolGGcndQzApPJ@nand.local \
--to=me@ttaylorr.com \
--cc=ethomson@edwardthomson.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.