mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
reftable: convert from strbuf to reftable_buf
Convert the reftable library to use the `reftable_buf` interface instead of the `strbuf` interface. This is mostly a mechanical change via sed(1) with some manual fixes where functions for `strbuf` and `reftable_buf` differ. The converted code does not yet handle allocation failures. This will be handled in subsequent commits. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
committed by
Taylor Blau
parent
81eddda540
commit
be4c070a3c
@@ -38,7 +38,7 @@ struct block_writer {
|
||||
uint32_t restart_len;
|
||||
uint32_t restart_cap;
|
||||
|
||||
struct strbuf last_key;
|
||||
struct reftable_buf last_key;
|
||||
int entries;
|
||||
};
|
||||
|
||||
@@ -98,7 +98,7 @@ void block_reader_release(struct block_reader *br);
|
||||
uint8_t block_reader_type(const struct block_reader *r);
|
||||
|
||||
/* Decodes the first key in the block */
|
||||
int block_reader_first_key(const struct block_reader *br, struct strbuf *key);
|
||||
int block_reader_first_key(const struct block_reader *br, struct reftable_buf *key);
|
||||
|
||||
/* Iterate over entries in a block */
|
||||
struct block_iter {
|
||||
@@ -109,13 +109,13 @@ struct block_iter {
|
||||
int hash_size;
|
||||
|
||||
/* key for last entry we read. */
|
||||
struct strbuf last_key;
|
||||
struct strbuf scratch;
|
||||
struct reftable_buf last_key;
|
||||
struct reftable_buf scratch;
|
||||
};
|
||||
|
||||
#define BLOCK_ITER_INIT { \
|
||||
.last_key = STRBUF_INIT, \
|
||||
.scratch = STRBUF_INIT, \
|
||||
.last_key = REFTABLE_BUF_INIT, \
|
||||
.scratch = REFTABLE_BUF_INIT, \
|
||||
}
|
||||
|
||||
/* Position `it` at start of the block */
|
||||
@@ -123,7 +123,7 @@ void block_iter_seek_start(struct block_iter *it, const struct block_reader *br)
|
||||
|
||||
/* Position `it` to the `want` key in the block */
|
||||
int block_iter_seek_key(struct block_iter *it, const struct block_reader *br,
|
||||
struct strbuf *want);
|
||||
struct reftable_buf *want);
|
||||
|
||||
/* return < 0 for error, 0 for OK, > 0 for EOF. */
|
||||
int block_iter_next(struct block_iter *it, struct reftable_record *rec);
|
||||
|
||||
Reference in New Issue
Block a user