From: Markus Elfring <Markus.Elfring@web.de>
To: git@vger.kernel.org
Cc: "René Scharfe" <l.s.r@web.de>
Subject: [PATCH] coccinelle: merge three rules from qsort.cocci
Date: Tue, 12 Nov 2019 19:36:46 +0100 [thread overview]
Message-ID: <5124838e-a297-ff24-d0bd-c5d95e2f83f7@web.de> (raw)
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
next reply other threads:[~2019-11-12 18:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 18:36 Markus Elfring [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-11-12 18:36 [PATCH] coccinelle: merge three rules from qsort.cocci Markus Elfring
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=5124838e-a297-ff24-d0bd-c5d95e2f83f7@web.de \
--to=markus.elfring@web.de \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.