git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] coccinelle: merge two rules from flex_alloc.cocci
@ 2019-11-12 15:34 Markus Elfring
  2019-11-12 17:59 ` Denton Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Markus Elfring @ 2019-11-12 15:34 UTC (permalink / raw)
  To: git; +Cc: Denton Liu

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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-11-15  5:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 15:34 [PATCH] coccinelle: merge two rules from flex_alloc.cocci Markus Elfring
2019-11-12 17:59 ` 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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).