* [PATCH] coccinelle: merge three rules from qsort.cocci
@ 2019-11-12 18:36 Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2019-11-12 18:36 UTC (permalink / raw)
To: git; +Cc: René Scharfe
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 12 Nov 2019 19:30:28 +0100
This script contained three transformation rules for the semantic patch language
where a condition check should be removed before QSORT() calls.
Combine these rules by using a SmPL disjunction.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
contrib/coccinelle/qsort.cocci | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/contrib/coccinelle/qsort.cocci b/contrib/coccinelle/qsort.cocci
index 22b93a9966..b2130a5e51 100644
--- a/contrib/coccinelle/qsort.cocci
+++ b/contrib/coccinelle/qsort.cocci
@@ -21,17 +21,5 @@ expression nmemb, compar;
@@
expression base, nmemb, compar;
@@
-- if (nmemb)
- QSORT(base, nmemb, compar);
-
-@@
-expression base, nmemb, compar;
-@@
-- if (nmemb > 0)
- QSORT(base, nmemb, compar);
-
-@@
-expression base, nmemb, compar;
-@@
-- if (nmemb > 1)
+- if ( \( nmemb \| nmemb > \( 0 \| 1 \) \) )
QSORT(base, nmemb, compar);
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] coccinelle: merge three rules from qsort.cocci
@ 2019-11-12 18:36 Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2019-11-12 18:36 UTC (permalink / raw)
To: git; +Cc: René Scharfe
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 12 Nov 2019 19:30:28 +0100
This script contained three transformation rules for the semantic patch language
where a condition check should be removed before QSORT() calls.
Combine these rules by using a SmPL disjunction.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
contrib/coccinelle/qsort.cocci | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/contrib/coccinelle/qsort.cocci b/contrib/coccinelle/qsort.cocci
index 22b93a9966..b2130a5e51 100644
--- a/contrib/coccinelle/qsort.cocci
+++ b/contrib/coccinelle/qsort.cocci
@@ -21,17 +21,5 @@ expression nmemb, compar;
@@
expression base, nmemb, compar;
@@
-- if (nmemb)
- QSORT(base, nmemb, compar);
-
-@@
-expression base, nmemb, compar;
-@@
-- if (nmemb > 0)
- QSORT(base, nmemb, compar);
-
-@@
-expression base, nmemb, compar;
-@@
-- if (nmemb > 1)
+- if ( \( nmemb \| nmemb > \( 0 \| 1 \) \) )
QSORT(base, nmemb, compar);
--
2.24.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-12 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 18:36 [PATCH] coccinelle: merge three rules from qsort.cocci Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2019-11-12 18:36 Markus Elfring
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).