diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-10-17 06:53:56 +0200 |
---|---|---|
committer | Taylor Blau <me@ttaylorr.com> | 2024-10-17 22:59:56 +0200 |
commit | be4c070a3c9e7c9d6836c724929ff8a365361e1a (patch) | |
tree | 03cec9016c899456a020c06e98239963a2958238 /reftable/block.h | |
parent | reftable/basics: provide new `reftable_buf` interface (diff) | |
download | git-be4c070a3c9e7c9d6836c724929ff8a365361e1a.tar.xz git-be4c070a3c9e7c9d6836c724929ff8a365361e1a.zip |
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>
Diffstat (limited to 'reftable/block.h')
-rw-r--r-- | reftable/block.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/reftable/block.h b/reftable/block.h index 18d7ea0337..9a3effa513 100644 --- a/reftable/block.h +++ b/reftable/block.h @@ -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); |