Re: [PATCH v2 01/10] reftable: stop using `strbuf_addbuf()`
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Oct 14, 2024, 22:19 UTC
- Message-ID
- <Zw2Y3cOz4px0TEsj@nand.local>
- In-Reply-To
- <7408482c152bbf465ecd098059b1477fd38c251a.1728910727.git.ps@pks.im>
On Mon, Oct 14, 2024 at 03:02:19PM +0200, Patrick Steinhardt wrote:
Show 24 quoted lines
> We're about to introduce our own `reftable_buf` type to replace > `strbuf`. Get rid of the seldomly-used `strbuf_addbuf()` function such > that we have to reimplement one less function. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > --- > reftable/block.c | 2 +- > reftable/record.c | 6 +++--- > reftable/writer.c | 7 ++++--- > 3 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/reftable/block.c b/reftable/block.c > index 8d41a2f99ed..cd4180eac7b 100644 > --- a/reftable/block.c > +++ b/reftable/block.c > @@ -60,7 +60,7 @@ static int block_writer_register_restart(struct block_writer *w, int n, > w->next += n; > > strbuf_reset(&w->last_key); > - strbuf_addbuf(&w->last_key, key); > + strbuf_add(&w->last_key, key->buf, key->len); > w->entries++; > return 0; > }
OK, this makes sense. FWIW, it feels like this would have been an easy function to port over to the new 'reftable_buf' type. But I understand wanting to implement fewer functions if possible.
Thanks, Taylor