aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-05-13 10:18:04 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-13 17:02:38 -0700
commite0cf3d8f8bc0480e67ac83502c10d6e6c38e1e11 (patch)
treeafdc101793cba23cd28108b22d3b0448c36347e8
parent799237852bd265feb1e1a8d4a19780e20991b4fd (diff)
downloadgit-e0cf3d8f8bc0480e67ac83502c10d6e6c38e1e11.tar.gz
reftable/writer: drop static variable used to initialize strbuf
We have a static variable in the reftable writer code that is merely used to initialize the `last_key` of the writer. Convert the code to instead use `strbuf_init()` and drop the variable. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--reftable/writer.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/reftable/writer.c b/reftable/writer.c
index 4cc6e2ebd8..a043025b01 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -117,8 +117,6 @@ static void writer_reinit_block_writer(struct reftable_writer *w, uint8_t typ)
w->block_writer->restart_interval = w->opts.restart_interval;
}
-static struct strbuf reftable_empty_strbuf = STRBUF_INIT;
-
struct reftable_writer *
reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
int (*flush_func)(void *),
@@ -136,7 +134,7 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
}
strbuf_init(&wp->block_writer_data.last_key, 0);
- wp->last_key = reftable_empty_strbuf;
+ strbuf_init(&wp->last_key, 0);
REFTABLE_CALLOC_ARRAY(wp->block, opts.block_size);
wp->write = writer_func;
wp->write_arg = writer_arg;