git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] strvec: use correct member name in comments

From
Jeff King <peff@peff.net>
Date
Jan 12, 2024, 07:41 UTC
Message-ID
<20240112074138.GH618729@coredump.intra.peff.net>
In-Reply-To
<pull.1640.git.1705043195997.gitgitgadget@gmail.com>
On Fri, Jan 12, 2024 at 07:06:35AM +0000, Linus Arver via GitGitGadget wrote:
Show 13 quoted lines
> From: Linus Arver <linusa@google.com>
> 
> In d70a9eb611 (strvec: rename struct fields, 2020-07-28), we renamed the
> "argv" member to "v". In the same patch we also did the following rename
> in strvec.c:
> 
>     -void strvec_pushv(struct strvec *array, const char **argv)
>     +void strvec_pushv(struct strvec *array, const char **items)
> 
> and it appears that this s/argv/items operation was erroneously applied
> to strvec.h.
> 
> Rename "items" to "v".

Good catch. The source of the problem is that the patch originally used "items" in the struct, too, but after review we settled on the more concise "v". I'd almost certainly have then flipped the name in the struct definition and relied on the compiler to help find the fallout. But of course it doesn't look in comments. :)

As you note, we still call use "items" for the vector passed in to pushv. I think that is OK, and there is no real need to use the terse "v" there (it is also purely internal; the declaration in strvec.h does not name it at all).

So this patch looks great to me. Thanks!
-Peff
Previous: Linus Arver via GitGitGadgetNext: Linus Arver
Message 2 of 7 in “strvec: use correct member name in comments”
  1. strvec: use correct member name in commentsLinus Arver via GitGitGadget, Jan 12, 2024
  2. Jeff KingJan 12, 2024
  3. Linus ArverJan 12, 2024
  4. Junio C HamanoJan 12, 2024
  5. Linus ArverJan 13, 2024
  6. Jeff KingJan 13, 2024
  7. Linus ArverJan 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.