summaryrefslogtreecommitdiff
path: root/admin/coccinelle
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-07-10 20:53:26 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-07-10 20:53:26 +0400
commit7d7bbefd049fc22cf3bf333592abf57a3bde8766 (patch)
treeab416b8873bb2c77a6d247b1c65a94ec5d274d3b /admin/coccinelle
parent3a4c8000fba422ac9d005d29ad0c5d8becc58167 (diff)
downloademacs-7d7bbefd049fc22cf3bf333592abf57a3bde8766.tar.gz
Use XCAR and XCDR instead of Fcar and Fcdr where possible.
* admin/coccinelle/list_loop.cocci: Semantic patch to convert from Fcdr to XCDR and consistently use CONSP in the list iteration loops. * admin/coccinelle/vector_contents.cocci: Fix indentation. * src/callint.c, src/coding.c, src/doc.c, src/editfns.c, src/eval.c, * src/font.c, src/fontset.c, src/frame.c, src/gnutls.c, src/minibuf.c, * src/msdos.c, src/textprop.c, src/w32fns.c, src/w32menu.c, src/window.c, * src/xmenu.c: Changed to use XCAR and XCDR where argument type is known to be a Lisp_Cons.
Diffstat (limited to 'admin/coccinelle')
-rw-r--r--admin/coccinelle/list_loop.cocci19
-rw-r--r--admin/coccinelle/vector_contents.cocci4
2 files changed, 21 insertions, 2 deletions
diff --git a/admin/coccinelle/list_loop.cocci b/admin/coccinelle/list_loop.cocci
new file mode 100644
index 00000000000..89f0bfff7b3
--- /dev/null
+++ b/admin/coccinelle/list_loop.cocci
@@ -0,0 +1,19 @@
+// Omit redundant type check, consistently use CONSP.
+@@
+identifier A;
+expression X;
+statement S;
+@@
+(
+for (A = X;
+- !NILP (A);
++ CONSP (A);
+- A = Fcdr (A))
++ A = XCDR (A))
+S
+|
+for (A = X; CONSP (A);
+- A = Fcdr (A))
++ A = XCDR (A))
+S
+)
diff --git a/admin/coccinelle/vector_contents.cocci b/admin/coccinelle/vector_contents.cocci
index beebc2d2089..3c696ffd237 100644
--- a/admin/coccinelle/vector_contents.cocci
+++ b/admin/coccinelle/vector_contents.cocci
@@ -11,6 +11,6 @@ expression E1, E2;
- XVECTOR (I1)->contents[E1] = E2
+ ASET (I1, E1, E2)
|
--XVECTOR (I1)->contents[E1]
-+AREF (I1, E1)
+- XVECTOR (I1)->contents[E1]
++ AREF (I1, E1)
)