{"thread":{"id":"52239","subject":"[PATCH] coccinelle: merge two rules from free.cocci","startedAt":"2019-11-12T14:15:09Z","lastAt":"2019-11-12T14:15:09Z","messageCount":1,"participants":["Markus Elfring"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"386014","messageId":"17c6e9d5-5a06-8150-fa82-e20e7b850fe4@web.de","threadId":"52239","inReplyTo":null,"subject":"[PATCH] coccinelle: merge two rules from free.cocci","fromName":"Markus Elfring","fromEmail":"markus.elfring@web.de","sentAt":"2019-11-12T14:15:05Z","receivedAt":"2019-11-12T14:15:09Z","isPatch":true,"sender":{"key":"markus.elfring@web.de","avatar":null},"body":"From: Markus Elfring <elfring@users.sourceforge.net>\nDate: Tue, 12 Nov 2019 15:00:29 +0100\n\nThis script contained two transformation rules for the semantic patch language\nwhere a condition check should be removed before free() calls.\nIt should not matter if a corresponding expression begins with a not operator\n(or not). Thus combine these rules by using a SmPL disjunction.\n\nSigned-off-by: Markus Elfring <elfring@users.sourceforge.net>\n---\n contrib/coccinelle/free.cocci | 8 +-------\n 1 file changed, 1 insertion(+), 7 deletions(-)\n\ndiff --git a/contrib/coccinelle/free.cocci b/contrib/coccinelle/free.cocci\nindex 4490069df9..63e442d3ef 100644\n--- a/contrib/coccinelle/free.cocci\n+++ b/contrib/coccinelle/free.cocci\n@@ -1,13 +1,7 @@\n @@\n expression E;\n @@\n-- if (E)\n-  free(E);\n-\n-@@\n-expression E;\n-@@\n-- if (!E)\n+- if ( \\( E \\| !E \\) )\n   free(E);\n\n @@\n--\n2.24.0\n\n"}]}