Skip to content

Commit e0cf3d8

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7992378 commit e0cf3d8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

reftable/writer.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ static void writer_reinit_block_writer(struct reftable_writer *w, uint8_t typ)
117117
w->block_writer->restart_interval = w->opts.restart_interval;
118118
}
119119

120-
static struct strbuf reftable_empty_strbuf = STRBUF_INIT;
121-
122120
struct reftable_writer *
123121
reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
124122
int (*flush_func)(void *),
@@ -136,7 +134,7 @@ reftable_new_writer(ssize_t (*writer_func)(void *, const void *, size_t),
136134
}
137135

138136
strbuf_init(&wp->block_writer_data.last_key, 0);
139-
wp->last_key = reftable_empty_strbuf;
137+
strbuf_init(&wp->last_key, 0);
140138
REFTABLE_CALLOC_ARRAY(wp->block, opts.block_size);
141139
wp->write = writer_func;
142140
wp->write_arg = writer_arg;

0 commit comments

Comments
 (0)