From: Markus Elfring <Markus.Elfring@web•de>
To: git@vger•kernel.org
Cc: Denton Liu <liu.denton@gmail•com>
Subject: [PATCH] coccinelle: merge two rules from flex_alloc.cocci
Date: Tue, 12 Nov 2019 16:34:34 +0100 [thread overview]
Message-ID: <f867512c-e5b2-6bca-2a37-2976f4c182bd@web.de> (raw)
From: Markus Elfring <elfring@users•sourceforge.net>
Date: Tue, 12 Nov 2019 16:30:14 +0100
This script contained two transformation rules for the semantic patch language
which used duplicate code.
Thus combine these rules by using a SmPL disjunction for the replacement
of two identifiers.
Signed-off-by: Markus Elfring <elfring@users•sourceforge.net>
---
contrib/coccinelle/flex_alloc.cocci | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/contrib/coccinelle/flex_alloc.cocci b/contrib/coccinelle/flex_alloc.cocci
index e9f7f6d861..1b4fa8f801 100644
--- a/contrib/coccinelle/flex_alloc.cocci
+++ b/contrib/coccinelle/flex_alloc.cocci
@@ -1,13 +1,14 @@
-@@
+@adjustment@
expression str;
-identifier x, flexname;
-@@
-- FLEX_ALLOC_MEM(x, flexname, str, strlen(str));
-+ FLEX_ALLOC_STR(x, flexname, str);
-
-@@
-expression str;
-identifier x, ptrname;
-@@
-- FLEXPTR_ALLOC_MEM(x, ptrname, str, strlen(str));
-+ FLEXPTR_ALLOC_STR(x, ptrname, str);
+identifier x, name;
+@@
+(
+-FLEX_ALLOC_MEM
++FLEX_ALLOC_STR
+|
+-FLEXPTR_ALLOC_MEM
++FLEXPTR_ALLOC_STR
+)
+ (x, name, str
+- , strlen(str)
+ );
--
2.24.0
next reply other threads:[~2019-11-12 15:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 15:34 Markus Elfring [this message]
2019-11-12 17:59 ` [PATCH] coccinelle: merge two rules from flex_alloc.cocci Denton Liu
2019-11-13 18:27 ` Martin Ågren
2019-11-13 21:10 ` Markus Elfring
2019-11-14 6:37 ` Martin Ågren
2019-11-14 8:15 ` Markus Elfring
2019-11-14 16:35 ` SZEDER Gábor
2019-11-14 17:30 ` Markus Elfring
2019-11-15 5:13 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f867512c-e5b2-6bca-2a37-2976f4c182bd@web.de \
--to=markus.elfring@web$(echo .)de \
--cc=git@vger$(echo .)kernel.org \
--cc=liu.denton@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox