Re: [PATCH v2 7/7] strvec API users: change some "int" tracking "nr" to "size_t"

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

 



On Sat, Sep 11, 2021 at 8:16 PM Ævar Arnfjörð Bjarmason
<avarab@xxxxxxxxx> wrote:
> Now that the strvec.h "int nr" has been changed to "size_t nr" in the
> preceding commit change various users of the API so that their local
> tracking (usually for-loop iteration) of the number of items in the
> array uses "size_t" as well.

s/change/changed/

> These were found by changing the "nr" member to a pointer temporarily,
> and manually looking at the codepaths that the compiler complained
> about.
>
> As argued in <YTIBnT8Ue1HZXs82@xxxxxxxxxxxxxxxxxxxxxxx>[1] these
> changes are not strictly necessary as a follow-up, but let's do them
> anyway so we don't need to wonder about the "size_t" v.s. "int"
> inconsistency going forward.
>
> As noted in <87v93i8svd.fsf@xxxxxxxxxxxxxxxxxxx> in that thread we

s/>/>[2]/

> have various things that interact with the "int argc" passed from
> main() (e.g. setup_revisions()) and "struct strvec". Those things
> could consistently use "int" before, but will now use some mixture of
> "int" and "size_t". That's OK, but is the reason we're not converting
> all API users to use "size_t" here for their own copies of "nr", or
> when they pass that "nr" to other functions.
>
> 1. https://lore.kernel.org/git/YTIBnT8Ue1HZXs82@xxxxxxxxxxxxxxxxxxxxxxx/
> 2. https://lore.kernel.org/git/87v93i8svd.fsf@xxxxxxxxxxxxxxxxxxx/
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>



[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