Re: [PATCH v2 01/13] reftable/block: use `size_t` to track restart point index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 21, 2024 at 01:34:48PM +0000, Karthik Nayak wrote:
> Patrick Steinhardt <ps@xxxxxx> writes:
> 
> > 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.
> 
> More of a question for my understanding: Why use `size_t` vs `uint16_t`
> here? I'm asking since the restart count is defined as `uint16_t
> restart_count` in `struct block_reader`.

Mostly because all callers already use `size_t`, and it's customary to
use them when talking about indices. We could use `uint16_t`, too, but
it didn't really feel worth it to adjust all callers.

Patrick

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux