reftable: stop using `strbuf_addbuf()`
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> Signed-off-by: Taylor Blau <me@ttaylorr.com>maint
parent
ef8ce8f3d4
commit
409f04995e
|
|
@ -60,7 +60,7 @@ static int block_writer_register_restart(struct block_writer *w, int n,
|
||||||
w->next += n;
|
w->next += n;
|
||||||
|
|
||||||
strbuf_reset(&w->last_key);
|
strbuf_reset(&w->last_key);
|
||||||
strbuf_addbuf(&w->last_key, key);
|
strbuf_add(&w->last_key, key->buf, key->len);
|
||||||
w->entries++;
|
w->entries++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1031,7 +1031,7 @@ static void reftable_index_record_key(const void *r, struct strbuf *dest)
|
||||||
{
|
{
|
||||||
const struct reftable_index_record *rec = r;
|
const struct reftable_index_record *rec = r;
|
||||||
strbuf_reset(dest);
|
strbuf_reset(dest);
|
||||||
strbuf_addbuf(dest, &rec->last_key);
|
strbuf_add(dest, rec->last_key.buf, rec->last_key.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_index_record_copy_from(void *rec, const void *src_rec,
|
static int reftable_index_record_copy_from(void *rec, const void *src_rec,
|
||||||
|
|
@ -1041,7 +1041,7 @@ static int reftable_index_record_copy_from(void *rec, const void *src_rec,
|
||||||
const struct reftable_index_record *src = src_rec;
|
const struct reftable_index_record *src = src_rec;
|
||||||
|
|
||||||
strbuf_reset(&dst->last_key);
|
strbuf_reset(&dst->last_key);
|
||||||
strbuf_addbuf(&dst->last_key, &src->last_key);
|
strbuf_add(&dst->last_key, src->last_key.buf, src->last_key.len);
|
||||||
dst->offset = src->offset;
|
dst->offset = src->offset;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1085,7 +1085,7 @@ static int reftable_index_record_decode(void *rec, struct strbuf key,
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
strbuf_reset(&r->last_key);
|
strbuf_reset(&r->last_key);
|
||||||
strbuf_addbuf(&r->last_key, &key);
|
strbuf_add(&r->last_key, key.buf, key.len);
|
||||||
|
|
||||||
n = get_var_int(&r->offset, &in);
|
n = get_var_int(&r->offset, &in);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ static int writer_index_hash(struct reftable_writer *w, struct strbuf *hash)
|
||||||
*key = empty;
|
*key = empty;
|
||||||
|
|
||||||
strbuf_reset(&key->hash);
|
strbuf_reset(&key->hash);
|
||||||
strbuf_addbuf(&key->hash, hash);
|
strbuf_add(&key->hash, hash->buf, hash->len);
|
||||||
tree_insert(&w->obj_index_tree, key,
|
tree_insert(&w->obj_index_tree, key,
|
||||||
&obj_index_tree_node_compare);
|
&obj_index_tree_node_compare);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -256,7 +256,7 @@ static int writer_add_record(struct reftable_writer *w,
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_reset(&w->last_key);
|
strbuf_reset(&w->last_key);
|
||||||
strbuf_addbuf(&w->last_key, &key);
|
strbuf_add(&w->last_key, key.buf, key.len);
|
||||||
if (!w->block_writer) {
|
if (!w->block_writer) {
|
||||||
err = writer_reinit_block_writer(w, reftable_record_type(rec));
|
err = writer_reinit_block_writer(w, reftable_record_type(rec));
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
|
@ -778,7 +778,8 @@ static int writer_flush_nonempty_block(struct reftable_writer *w)
|
||||||
|
|
||||||
index_record.offset = w->next;
|
index_record.offset = w->next;
|
||||||
strbuf_reset(&index_record.last_key);
|
strbuf_reset(&index_record.last_key);
|
||||||
strbuf_addbuf(&index_record.last_key, &w->block_writer->last_key);
|
strbuf_add(&index_record.last_key, w->block_writer->last_key.buf,
|
||||||
|
w->block_writer->last_key.len);
|
||||||
w->index[w->index_len] = index_record;
|
w->index[w->index_len] = index_record;
|
||||||
w->index_len++;
|
w->index_len++;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue