Re: [PATCH v2 7/7] strvec API users: change some "int" tracking "nr" to "size_t"
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Sep 12, 2021, 03:00 UTC
- Message-ID
- <CAPig+cTdisiKU-8i3kRuDqtwy6eQOA+jNbz8WGm627ojUwkgbA@mail.gmail.com>
- In-Reply-To
- <patch-v2-7.7-2edd9708888-20210912T001420Z-avarab@gmail.com>
On Sat, Sep 11, 2021 at 8:16 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> 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/
Show 10 quoted lines
> 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@coredump.intra.peff.net>[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@evledraar.gmail.com> in that thread we
s/>/>[2]/
Show 11 quoted lines
> 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@coredump.intra.peff.net/ > 2. https://lore.kernel.org/git/87v93i8svd.fsf@evledraar.gmail.com/ > > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>