summaryrefslogtreecommitdiffstats
path: root/reftable/block.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2023-12-11 10:08:07 +0100
committerJunio C Hamano <gitster@pobox.com>2023-12-11 16:23:17 +0100
commita8305bc6d8eb55cf52264964c8fc0289b72f2fd8 (patch)
treeb42facff286a99ea07ac7b5abb294b54a2843c27 /reftable/block.h
parentreftable/merged: reuse buffer to compute record keys (diff)
downloadgit-a8305bc6d8eb55cf52264964c8fc0289b72f2fd8.tar.xz
git-a8305bc6d8eb55cf52264964c8fc0289b72f2fd8.zip
reftable/block: introduce macro to initialize `struct block_iter`
There are a bunch of locations where we initialize members of `struct block_iter`, which makes it harder than necessary to expand this struct to have additional members. Unify the logic via a new `BLOCK_ITER_INIT` macro that initializes all members. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/block.h')
-rw-r--r--reftable/block.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/reftable/block.h b/reftable/block.h
index 87c77539b5..51699af233 100644
--- a/reftable/block.h
+++ b/reftable/block.h
@@ -86,6 +86,10 @@ struct block_iter {
struct strbuf last_key;
};
+#define BLOCK_ITER_INIT { \
+ .last_key = STRBUF_INIT, \
+}
+
/* initializes a block reader. */
int block_reader_init(struct block_reader *br, struct reftable_block *bl,
uint32_t header_off, uint32_t table_block_size,