Re: [PATCH v2 7/7] strvec API users: change some "int" tracking "nr" to "size_t"
flat view
From: Eric Sunshine <hidden>
Date: 2021-09-12 03:00:50
On Sat, Sep 11, 2021 at 8:16 PM Ævar Arnfjörð Bjarmason [off-list ref] 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 [ref][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 [ref] 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@coredump.intra.peff.net/ (local) 2. https://lore.kernel.org/git/87v93i8svd.fsf@evledraar.gmail.com/ (local) Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>