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

Re: [PATCH 0/2] create FLEX_ALLOC_MEM to FLEX_ALLOC_STR cocci rule

From
Jeff King <peff@peff.net>
Date
Apr 4, 2019, 01:57 UTC
Message-ID
<20190404015659.GE4409@sigill.intra.peff.net>
In-Reply-To
<cover.1554328261.git.liu.denton@gmail.com>
On Wed, Apr 03, 2019 at 03:00:03PM -0700, Denton Liu wrote:
Show 7 quoted lines
> I was playing around with coccinelle and I noticed that we have a use of
> FLEX_ALLOC_MEM that could be converted into FLEX_ALLOC_STR. Convert it
> and write a cocci rule to prevent this from happening.
> 
> Note that this was more of an exercise to teach myself how to use
> coccinelle. I'm just submitting a useful patch that came as a result of
> this. Please let me know if this is unwelcome.

Both look pretty reasonable to me. Obviously it's a pretty trivial change, but that's sort of the point: automate these things away so we don't have to think about them during review.

Now if you could figure out a way to point people to FLEX_ALLOC in the first place when they are not currently using it, _that_ would be pretty amazing. But I suspect it's a bit too complicated. :)

-Peff
Previous: Denton Liu
Message 4 of 4 in “create FLEX_ALLOC_MEM to FLEX_ALLOC_STR cocci rule”
  1. 0/2 create FLEX_ALLOC_MEM to FLEX_ALLOC_STR cocci ruleDenton Liu, Apr 3, 2019
  2. 1/2 midx.c: convert FLEX_ALLOC_MEM to FLEX_ALLOC_STRDenton Liu, Apr 3, 2019
  3. 2/2 cocci: FLEX_ALLOC_MEM to FLEX_ALLOC_STRDenton Liu, Apr 3, 2019
  4. Jeff KingApr 4, 2019

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.