Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v2 01/13] reftable/block: use `size_t` to track restart point index
Date: Mon, 13 May 2024 10:47:01 +0200	[thread overview]
Message-ID: <ca86a8b58dd074287dd2dd352610ffe46e1605b9.1715589670.git.ps@pks.im> (raw)
In-Reply-To: <cover.1715589670.git.ps@pks.im>

[-- Attachment #1: Type: text/plain, Size: 1062 bytes --]

The function `block_reader_restart_offset()` gets the offset of the
`i`th restart point. `i` is a signed integer though, which is certainly
not the correct type to track indices like this. Furthermore, both
callers end up passing a `size_t`.

Refactor the code to use a `size_t` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 reftable/block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/reftable/block.c b/reftable/block.c
index 5942cb4053..00030eee06 100644
--- a/reftable/block.c
+++ b/reftable/block.c
@@ -326,9 +326,9 @@ int block_reader_first_key(const struct block_reader *br, struct strbuf *key)
 	return 0;
 }
 
-static uint32_t block_reader_restart_offset(const struct block_reader *br, int i)
+static uint32_t block_reader_restart_offset(const struct block_reader *br, size_t idx)
 {
-	return get_be24(br->restart_bytes + 3 * i);
+	return get_be24(br->restart_bytes + 3 * idx);
 }
 
 void block_iter_seek_start(struct block_iter *it, const struct block_reader *br)
-- 
2.45.GIT


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-05-13  8:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 11:03 [PATCH 00/13] reftable: prepare for re-seekable iterators Patrick Steinhardt
2024-05-08 11:03 ` [PATCH 01/13] reftable/block: use `size_t` to track restart point index Patrick Steinhardt
2024-05-08 11:03 ` [PATCH 02/13] reftable/reader: avoid copying index iterator Patrick Steinhardt
2024-05-08 11:03 ` [PATCH 03/13] reftable/reader: unify indexed and linear seeking Patrick Steinhardt
2024-05-08 11:03 ` [PATCH 04/13] reftable/reader: separate concerns of table iter and reftable reader Patrick Steinhardt
2024-05-08 11:03 ` [PATCH 05/13] reftable/reader: inline `reader_seek_internal()` Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 06/13] reftable/reader: set up the reader when initializing table iterator Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 07/13] reftable/merged: split up initialization and seeking of records Patrick Steinhardt
2024-05-10 19:18   ` Justin Tobler
2024-05-13  8:36     ` Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 08/13] reftable/merged: simplify indices for subiterators Patrick Steinhardt
2024-05-10 19:25   ` Justin Tobler
2024-05-13  8:36     ` Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 09/13] reftable/generic: move seeking of records into the iterator Patrick Steinhardt
2024-05-10 21:44   ` Justin Tobler
2024-05-13  8:36     ` Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 10/13] reftable/generic: adapt interface to allow reuse of iterators Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 11/13] reftable/reader: " Patrick Steinhardt
2024-05-10 21:48   ` Justin Tobler
2024-05-13  8:36     ` Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 12/13] reftable/stack: provide convenience functions to create iterators Patrick Steinhardt
2024-05-08 11:04 ` [PATCH 13/13] reftable/merged: adapt interface to allow reuse of iterators Patrick Steinhardt
2024-05-08 23:42 ` [PATCH 00/13] reftable: prepare for re-seekable iterators Junio C Hamano
2024-05-09  0:16   ` Junio C Hamano
2024-05-10  7:48   ` Patrick Steinhardt
2024-05-10 15:40     ` Junio C Hamano
2024-05-10 16:13       ` Patrick Steinhardt
2024-05-10 17:17         ` Junio C Hamano
2024-05-13  8:46 ` [PATCH v2 " Patrick Steinhardt
2024-05-13  8:47   ` Patrick Steinhardt [this message]
2024-05-21 13:34     ` [PATCH v2 01/13] reftable/block: use `size_t` to track restart point index Karthik Nayak
2024-05-22  7:23       ` Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 02/13] reftable/reader: avoid copying index iterator Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 03/13] reftable/reader: unify indexed and linear seeking Patrick Steinhardt
2024-05-21 14:41     ` Karthik Nayak
2024-05-22  7:23       ` Patrick Steinhardt
2024-05-22  7:56         ` Karthik Nayak
2024-05-13  8:47   ` [PATCH v2 04/13] reftable/reader: separate concerns of table iter and reftable reader Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 05/13] reftable/reader: inline `reader_seek_internal()` Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 06/13] reftable/reader: set up the reader when initializing table iterator Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 07/13] reftable/merged: split up initialization and seeking of records Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 08/13] reftable/merged: simplify indices for subiterators Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 09/13] reftable/generic: move seeking of records into the iterator Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 10/13] reftable/generic: adapt interface to allow reuse of iterators Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 11/13] reftable/reader: " Patrick Steinhardt
2024-05-13  8:47   ` [PATCH v2 12/13] reftable/stack: provide convenience functions to create iterators Patrick Steinhardt
2024-05-13  8:48   ` [PATCH v2 13/13] reftable/merged: adapt interface to allow reuse of iterators Patrick Steinhardt
2024-05-15 20:15   ` [PATCH v2 00/13] reftable: prepare for re-seekable iterators Justin Tobler
2024-05-21 15:31   ` Karthik Nayak
2024-05-22  7:23     ` Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca86a8b58dd074287dd2dd352610ffe46e1605b9.1715589670.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jltobler@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).