coccinelle: merge two rules from free.cocci
PATCH 1/1 coccinelle: merge two rules from free.cocci
From: Markus Elfring <[email protected]>
Date: Tue, 12 Nov 2019 15:00:29 +0100
This script contained two transformation rules for the semantic patch language where a condition check should be removed before free() calls.
It should not matter if a corresponding expression begins with a not operator (or not). Thus combine these rules by using a SmPL disjunction.
Signed-off-by Markus Elfring <[email protected]>
--- contrib/coccinelle/free.cocci | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
contrib/coccinelle/free.cocci +1 -7
@@ -1,13 +1,7 @@ @@ expression E; @@ -- if (E) - free(E); - -@@ -expression E; -@@ -- if (!E) +- if ( \( E \| !E \) ) free(E); @@
--
2.24.0