[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1300229605-14499-1-git-send-email-kirill@shutemov.name>
Date: Wed, 16 Mar 2011 00:53:13 +0200
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: linux-kernel@...r.kernel.org
Cc: "Kirill A. Shutemov" <kirill@...temov.name>,
Julia Lawall <julia@...u.dk>,
Gilles Muller <Gilles.Muller@...6.fr>,
Nicolas Palix <npalix.work@...il.com>, cocci@...u.dk
Subject: [PATCH 01/13] Coccinelle: introduce list_move.cocci
Use list_move instead of combination of list_del() and list_add()
Signed-off-by: Kirill A. Shutemov <kirill@...temov.name>
Cc: Julia Lawall <julia@...u.dk>
Cc: Gilles Muller <Gilles.Muller@...6.fr>
Cc: Nicolas Palix <npalix.work@...il.com>
Cc: cocci@...u.dk
---
scripts/coccinelle/api/list/list_move.cocci | 41 +++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
create mode 100644 scripts/coccinelle/api/list/list_move.cocci
diff --git a/scripts/coccinelle/api/list/list_move.cocci b/scripts/coccinelle/api/list/list_move.cocci
new file mode 100644
index 0000000..2691a8a
--- /dev/null
+++ b/scripts/coccinelle/api/list/list_move.cocci
@@ -0,0 +1,41 @@
+///
+/// Use list_move() instead of combination of list_del() and list_add()
+///
+// Confidence: High
+// Copyright: (C) 2011 Kirill A. Shutemov. GPLv2.
+// Options: -no_includes -include_headers
+
+virtual context
+virtual patch
+virtual org
+virtual report
+
+@...ends on context@
+expression a, b;
+@@
+
+* list_del(a);
+* list_add(a, b);
+
+@...ends on patch@
+expression a, b;
+@@
+
+- list_del(a);
+- list_add(a, b);
++ list_move(a, b);
+
+@r depends on report || org@
+expression a, b;
+position p;
+@@
+
+ list_del@p(a);
+ list_add(a, b);
+
+@...ipt:python depends on org || report@
+p << r.p;
+@@
+
+msg = "WARNING: list_move() can be used"
+coccilib.report.print_report(p[0], msg)
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists