aboutsummaryrefslogtreecommitdiffstats
path: root/reftable/table.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-07 15:16:16 +0200
committerJunio C Hamano <gitster@pobox.com>2025-04-07 14:53:09 -0700
commitba620d296ab7bcd93fcedfe13b265f84df1ed1eb (patch)
treea64e7d6f200f86ea9e8a32ca621de1c487836c4f /reftable/table.c
parent1ac4e5e83d997887dcd051c89861292a45a3db8c (diff)
downloadgit-ba620d296ab7bcd93fcedfe13b265f84df1ed1eb.tar.gz
reftable/block: simplify how we track restart points
Restart points record the location of reftable records that do not use prefix compression and are used to perform a binary search inside of a block. These restart points are encoded at the end of a block, between the record data and the footer of a table. The block structure contains three different variables related to these restart points: - The block length contains the length of the reftable block up to the restart points. - The restart count contains the number of restart points contained in the block. - The restart bytes variable tracks where the restart point data begins. Tracking all three of these variables is unnecessary though as the data can be derived from one another: the block length without restart points is the exact same as the offset of the restart count data, which we already track via the `restart_bytes` data. Refactor the code so that we track the location of restart bytes not as a pointer, but instead as an offset. This allows us to trivially get rid of the `block_len` variable as described above. This avoids having the confusing `block_len` variable and allows us to do less bookkeeping overall. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/table.c')
-rw-r--r--reftable/table.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/reftable/table.c b/reftable/table.c
index d18e17b0d4..ec84545707 100644
--- a/reftable/table.c
+++ b/reftable/table.c
@@ -838,7 +838,7 @@ int reftable_table_print_blocks(const char *tablename)
printf("%s:\n", sections[i].name);
while (1) {
- printf(" - length: %u\n", ti.br.block_len);
+ printf(" - length: %u\n", ti.br.restart_off);
printf(" restarts: %u\n", ti.br.restart_count);
err = table_iter_next_block(&ti);