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