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

Re: [PATCH 0/2] coccinelle: detect and fix strbuf-by-value parameters

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 16, 2026, 15:35 UTC
Message-ID
<xmqq5x6vrdm1.fsf@gitster.g>
In-Reply-To
<20260315094445.19849-1-deveshigurgaon@gmail.com>
Deveshi Dwivedi <deveshigurgaon@gmail.com> writes:
Show 15 quoted lines
> While reviewing the write_worktree_linking_files() fix [1], Jeff King
> suggested adding a coccinelle rule to detect functions that take
> struct strbuf by value.  I previously posted an RFC discussing such a rule
> and its implementation [2].
>
> Patch 1/2 adds a coccinelle rule to detect functions that take
> struct strbuf by value and rewrites the parameter to a pointer
> to highlight the issue.
>
> Patch 2/2 fixes the one remaining instance found by the rule in
> stash.c by changing the parameter to struct strbuf * and
> updating the caller accordingly.
>
> The worktree.c instance that motivated the rule is already fixed
> by [1], so only the stash.c case remains.
Nicely done.  Will queue.  Thanks.
Previous: Deveshi Dwivedi
Message 4 of 4 in “coccinelle: detect and fix strbuf-by-value parameters”
  1. 0/2 coccinelle: detect and fix strbuf-by-value parametersDeveshi Dwivedi, Mar 15, 2026
  2. 1/2 coccinelle: detect struct strbuf passed by valueDeveshi Dwivedi, Mar 15, 2026
  3. 2/2 stash: do not pass strbuf by valueDeveshi Dwivedi, Mar 15, 2026
  4. Junio C HamanoMar 16, 2026

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.