Re: [PATCH 11/11] strvec: rename struct fields

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

 



Jeff King <peff@xxxxxxxx> writes:

> The "argc" and "argv" names made sense when the struct was argv_array,
> but now they're just confusing. Let's rename them to our usual "nr" and
> "items" (which we use for string_list, as well as many ALLOC_GROW()
> arrays).
>
> Note that we have to update all of the callers immediately. Playing
> tricks with the preprocessor is hard here, because we wouldn't want to
> rewrite unrelated tokens.
>
> Signed-off-by: Jeff King <peff@xxxxxxxx>
> ---
> I'm actually not that fond of "items". I almost went with just:
>
>   const char **v;
>
> as the variable name which contains it usually provides sufficient
> context. But I worried that people would consider that too inscrutable.

I'd agree that v[] is a good name.  If it is too short, I can live
with item[], but not with items[].  Clearly we are mostly accessing
one element at a time much more often than treating the set as a
whole, so signaling "there are multiple things in the set" with
a plural name is much less important than being able to say item[4]
to name the 4th item in the collection.





[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