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

Re: [PATCH] refactor various if (x) FREE_AND_NULL(x) to just FREE_AND_NULL(x)

From
Jeff King <peff@peff.net>
Date
Aug 17, 2018, 17:39 UTC
Message-ID
<20180817173951.GA9474@sigill.intra.peff.net>
In-Reply-To
<20180817173308.GA9111@sigill.intra.peff.net>
On Fri, Aug 17, 2018 at 01:33:08PM -0400, Jeff King wrote:
Show 12 quoted lines
> > And revised even more to also spell "E" as "E != NULL" (and "!E" as
> > "E == NULL"), which seems to make a difference, which is even more
> > sad.  I do not want to wonder if I have to also add "NULL == E" and
> > other variants, so I'll stop here.
> 
> I think it makes sense that these are all distinct if you're using
> coccinelle to do stylistic transformations between them (e.g., enforcing
> curly braces even around one-liners).
> 
> I wonder if there is a way to "relax" a pattern where these semantically
> equivalent cases can all be covered automatically. I don't know enough
> about the tool to say.
Hmm. They seem to call these "standard isomorphisms":
  http://coccinelle.lip6.fr/standard.iso.html

but I'm not sure of the correct way to use them (e.g., if we want to apply them for matching but not actually transform the code, though I am not actually opposed to transforming the code, too).

-Peff
Previous: Jeff KingNext: Jeff King
Message 10 of 12 in “gpg-interface.c: Fix potentially freeing NULL values”
  1. gpg-interface.c: Fix potentially freeing NULL valuesMichał Górny, Aug 17, 2018
  2. Eric SunshineAug 17, 2018
  3. Michał GórnyAug 17, 2018
  4. refactor various if (x) FREE_AND_NULL(x) to just FREE_AND_NULL(x)Ævar Arnfjörð Bjarmason, Aug 17, 2018
  5. Duy NguyenAug 17, 2018
  6. Duy NguyenAug 17, 2018
  7. Junio C HamanoAug 17, 2018
  8. Junio C HamanoAug 17, 2018
  9. Jeff KingAug 17, 2018
  10. Jeff KingAug 17, 2018
  11. Jeff KingAug 17, 2018
  12. Duy NguyenAug 17, 2018

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.