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

Re: [PATCH v2 01/10] reftable: stop using `strbuf_addbuf()`

From: Taylor Blau <hidden>
Date: 2024-10-14 22:19:12

On Mon, Oct 14, 2024 at 03:02:19PM +0200, Patrick Steinhardt wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help