aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-10 20:53:26 +0400
committerDmitry Antipov2012-07-10 20:53:26 +0400
commit7d7bbefd049fc22cf3bf333592abf57a3bde8766 (patch)
treeab416b8873bb2c77a6d247b1c65a94ec5d274d3b /src
parent3a4c8000fba422ac9d005d29ad0c5d8becc58167 (diff)
downloademacs-7d7bbefd049fc22cf3bf333592abf57a3bde8766.tar.gz
emacs-7d7bbefd049fc22cf3bf333592abf57a3bde8766.zip
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 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/callint.c2
-rw-r--r--src/coding.c4
-rw-r--r--src/doc.c2
-rw-r--r--src/editfns.c2
-rw-r--r--src/eval.c4
-rw-r--r--src/font.c4
-rw-r--r--src/fontset.c2
-rw-r--r--src/frame.c2
-rw-r--r--src/gnutls.c6
-rw-r--r--src/minibuf.c2
-rw-r--r--src/msdos.c2
-rw-r--r--src/textprop.c2
-rw-r--r--src/w32fns.c2
-rw-r--r--src/w32menu.c3
-rw-r--r--src/window.c2
-rw-r--r--src/xmenu.c3
17 files changed, 29 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1c451168e15..677b78ccbfb 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-07-10 Dmitry Antipov <dmantipov@yandex.ru>
2
3 Use XCAR and XCDR instead of Fcar and Fcdr where possible.
4 * callint.c, coding.c, doc.c, editfns.c, eval.c, font.c, fontset.c,
5 * frame.c, gnutls.c, minibuf.c, msdos.c, textprop.c, w32fns.c,
6 * w32menu.c, window.c, xmenu.c: Changed to use XCAR and XCDR
7 where argument type is known to be a Lisp_Cons.
8
12012-07-10 Tom Tromey <tromey@redhat.com> 92012-07-10 Tom Tromey <tromey@redhat.com>
2 10
3 * bytecode.c (BYTE_CODE_THREADED): New macro. 11 * bytecode.c (BYTE_CODE_THREADED): New macro.
diff --git a/src/callint.c b/src/callint.c
index 1a99ca2731c..58e1a5be2f4 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -205,7 +205,7 @@ fix_command (Lisp_Object input, Lisp_Object values)
205 if (CONSP (elt)) 205 if (CONSP (elt))
206 { 206 {
207 Lisp_Object presflag, carelt; 207 Lisp_Object presflag, carelt;
208 carelt = Fcar (elt); 208 carelt = XCAR (elt);
209 /* If it is (if X Y), look at Y. */ 209 /* If it is (if X Y), look at Y. */
210 if (EQ (carelt, Qif) 210 if (EQ (carelt, Qif)
211 && EQ (Fnthcdr (make_number (3), elt), Qnil)) 211 && EQ (Fnthcdr (make_number (3), elt), Qnil))
diff --git a/src/coding.c b/src/coding.c
index 8210cacc4d8..134ebf2ab73 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -9791,7 +9791,7 @@ usage: (define-coding-system-internal ...) */)
9791 9791
9792 val = args[coding_arg_ccl_valids]; 9792 val = args[coding_arg_ccl_valids];
9793 valids = Fmake_string (make_number (256), make_number (0)); 9793 valids = Fmake_string (make_number (256), make_number (0));
9794 for (tail = val; !NILP (tail); tail = Fcdr (tail)) 9794 for (tail = val; CONSP (tail); tail = XCDR (tail))
9795 { 9795 {
9796 int from, to; 9796 int from, to;
9797 9797
@@ -9892,7 +9892,7 @@ usage: (define-coding-system-internal ...) */)
9892 CHECK_NUMBER_CDR (reg_usage); 9892 CHECK_NUMBER_CDR (reg_usage);
9893 9893
9894 request = Fcopy_sequence (args[coding_arg_iso2022_request]); 9894 request = Fcopy_sequence (args[coding_arg_iso2022_request]);
9895 for (tail = request; ! NILP (tail); tail = Fcdr (tail)) 9895 for (tail = request; CONSP (tail); tail = XCDR (tail))
9896 { 9896 {
9897 int id; 9897 int id;
9898 Lisp_Object tmp1; 9898 Lisp_Object tmp1;
diff --git a/src/doc.c b/src/doc.c
index 6b356d57cb3..7d82211faea 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -381,7 +381,7 @@ string is passed through `substitute-command-keys'. */)
381 } 381 }
382 else if (CONSP (fun)) 382 else if (CONSP (fun))
383 { 383 {
384 funcar = Fcar (fun); 384 funcar = XCAR (fun);
385 if (!SYMBOLP (funcar)) 385 if (!SYMBOLP (funcar))
386 xsignal1 (Qinvalid_function, fun); 386 xsignal1 (Qinvalid_function, fun);
387 else if (EQ (funcar, Qkeymap)) 387 else if (EQ (funcar, Qkeymap))
diff --git a/src/editfns.c b/src/editfns.c
index f6d849fbc7a..e48097ab3a6 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1915,7 +1915,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1915 tm.tm_isdst = -1; 1915 tm.tm_isdst = -1;
1916 1916
1917 if (CONSP (zone)) 1917 if (CONSP (zone))
1918 zone = Fcar (zone); 1918 zone = XCAR (zone);
1919 if (NILP (zone)) 1919 if (NILP (zone))
1920 { 1920 {
1921 BLOCK_INPUT; 1921 BLOCK_INPUT;
diff --git a/src/eval.c b/src/eval.c
index 9da9ec05cae..f16fdc6dd4c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2070,8 +2070,8 @@ eval_sub (Lisp_Object form)
2070 error ("Lisp nesting exceeds `max-lisp-eval-depth'"); 2070 error ("Lisp nesting exceeds `max-lisp-eval-depth'");
2071 } 2071 }
2072 2072
2073 original_fun = Fcar (form); 2073 original_fun = XCAR (form);
2074 original_args = Fcdr (form); 2074 original_args = XCDR (form);
2075 2075
2076 backtrace.next = backtrace_list; 2076 backtrace.next = backtrace_list;
2077 backtrace_list = &backtrace; 2077 backtrace_list = &backtrace;
diff --git a/src/font.c b/src/font.c
index 1eca1c2eb29..ea6fc47884c 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1827,7 +1827,7 @@ check_otf_features (Lisp_Object otf_features)
1827 CHECK_CONS (otf_features); 1827 CHECK_CONS (otf_features);
1828 CHECK_SYMBOL (XCAR (otf_features)); 1828 CHECK_SYMBOL (XCAR (otf_features));
1829 otf_features = XCDR (otf_features); 1829 otf_features = XCDR (otf_features);
1830 for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val)) 1830 for (val = Fcar (otf_features); CONSP (val); val = XCDR (val))
1831 { 1831 {
1832 CHECK_SYMBOL (Fcar (val)); 1832 CHECK_SYMBOL (Fcar (val));
1833 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) 1833 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4)
@@ -1835,7 +1835,7 @@ check_otf_features (Lisp_Object otf_features)
1835 SDATA (SYMBOL_NAME (XCAR (val)))); 1835 SDATA (SYMBOL_NAME (XCAR (val))));
1836 } 1836 }
1837 otf_features = XCDR (otf_features); 1837 otf_features = XCDR (otf_features);
1838 for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val)) 1838 for (val = Fcar (otf_features); CONSP (val); val = XCDR (val))
1839 { 1839 {
1840 CHECK_SYMBOL (Fcar (val)); 1840 CHECK_SYMBOL (Fcar (val));
1841 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) 1841 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4)
diff --git a/src/fontset.c b/src/fontset.c
index bd5956d2bee..056ef31e4f1 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1668,7 +1668,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
1668 Fset_char_table_range (fontset, Qt, Qnil); 1668 Fset_char_table_range (fontset, Qt, Qnil);
1669 } 1669 }
1670 1670
1671 for (; ! NILP (fontlist); fontlist = Fcdr (fontlist)) 1671 for (; CONSP (fontlist); fontlist = XCDR (fontlist))
1672 { 1672 {
1673 Lisp_Object elt, script; 1673 Lisp_Object elt, script;
1674 1674
diff --git a/src/frame.c b/src/frame.c
index 61baa25be3d..3a3f5526035 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2754,7 +2754,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2754 struct gcpro gcpro1, gcpro2; 2754 struct gcpro gcpro1, gcpro2;
2755 2755
2756 i = 0; 2756 i = 0;
2757 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) 2757 for (tail = alist; CONSP (tail); tail = XCDR (tail))
2758 i++; 2758 i++;
2759 2759
2760 parms = alloca (i * sizeof *parms); 2760 parms = alloca (i * sizeof *parms);
diff --git a/src/gnutls.c b/src/gnutls.c
index 9c96379ff7e..21658a1bc82 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -871,7 +871,7 @@ one trustfile (usually a CA bundle). */)
871 int file_format = GNUTLS_X509_FMT_PEM; 871 int file_format = GNUTLS_X509_FMT_PEM;
872 Lisp_Object tail; 872 Lisp_Object tail;
873 873
874 for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail)) 874 for (tail = trustfiles; CONSP (tail); tail = XCDR (tail))
875 { 875 {
876 Lisp_Object trustfile = Fcar (tail); 876 Lisp_Object trustfile = Fcar (tail);
877 if (STRINGP (trustfile)) 877 if (STRINGP (trustfile))
@@ -893,7 +893,7 @@ one trustfile (usually a CA bundle). */)
893 } 893 }
894 } 894 }
895 895
896 for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail)) 896 for (tail = crlfiles; CONSP (tail); tail = XCDR (tail))
897 { 897 {
898 Lisp_Object crlfile = Fcar (tail); 898 Lisp_Object crlfile = Fcar (tail);
899 if (STRINGP (crlfile)) 899 if (STRINGP (crlfile))
@@ -913,7 +913,7 @@ one trustfile (usually a CA bundle). */)
913 } 913 }
914 } 914 }
915 915
916 for (tail = keylist; !NILP (tail); tail = Fcdr (tail)) 916 for (tail = keylist; CONSP (tail); tail = XCDR (tail))
917 { 917 {
918 Lisp_Object keyfile = Fcar (Fcar (tail)); 918 Lisp_Object keyfile = Fcar (Fcar (tail));
919 Lisp_Object certfile = Fcar (Fcdr (tail)); 919 Lisp_Object certfile = Fcar (Fcdr (tail));
diff --git a/src/minibuf.c b/src/minibuf.c
index acf57a73268..27c776857db 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -425,7 +425,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
425 if (CONSP (initial)) 425 if (CONSP (initial))
426 { 426 {
427 Lisp_Object backup_n = Fcdr (initial); 427 Lisp_Object backup_n = Fcdr (initial);
428 initial = Fcar (initial); 428 initial = XCAR (initial);
429 CHECK_STRING (initial); 429 CHECK_STRING (initial);
430 if (!NILP (backup_n)) 430 if (!NILP (backup_n))
431 { 431 {
diff --git a/src/msdos.c b/src/msdos.c
index 8a6a150a956..e19e4ef8f3a 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1618,7 +1618,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
1618 1618
1619 /* Extract parm names and values into those vectors. */ 1619 /* Extract parm names and values into those vectors. */
1620 i = 0; 1620 i = 0;
1621 for (tail = alist; CONSP (tail); tail = Fcdr (tail)) 1621 for (tail = alist; CONSP (tail); tail = XCDR (tail))
1622 { 1622 {
1623 Lisp_Object elt; 1623 Lisp_Object elt;
1624 1624
diff --git a/src/textprop.c b/src/textprop.c
index 4562cc0bd18..efce7259ce5 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -271,7 +271,7 @@ interval_has_some_properties_list (Lisp_Object list, INTERVAL i)
271 /* Go through each element of LIST. */ 271 /* Go through each element of LIST. */
272 for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1)) 272 for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1))
273 { 273 {
274 sym = Fcar (tail1); 274 sym = XCAR (tail1);
275 275
276 /* Go through i's plist, looking for tail1 */ 276 /* Go through i's plist, looking for tail1 */
277 for (tail2 = i->plist; CONSP (tail2); tail2 = XCDR (XCDR (tail2))) 277 for (tail2 = i->plist; CONSP (tail2); tail2 = XCDR (XCDR (tail2)))
diff --git a/src/w32fns.c b/src/w32fns.c
index 459d4c835f5..825f9815482 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -678,7 +678,7 @@ w32_color_map_lookup (char *colorname)
678 elt = XCAR (tail); 678 elt = XCAR (tail);
679 if (!CONSP (elt)) continue; 679 if (!CONSP (elt)) continue;
680 680
681 tem = Fcar (elt); 681 tem = XCAR (elt);
682 682
683 if (lstrcmpi (SDATA (tem), colorname) == 0) 683 if (lstrcmpi (SDATA (tem), colorname) == 0)
684 { 684 {
diff --git a/src/w32menu.c b/src/w32menu.c
index b957da67567..8adc6c62814 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -162,8 +162,7 @@ otherwise it is "Question". */)
162 } 162 }
163 else if (CONSP (position)) 163 else if (CONSP (position))
164 { 164 {
165 Lisp_Object tem; 165 Lisp_Object tem = XCAR (position);
166 tem = Fcar (position);
167 if (CONSP (tem)) 166 if (CONSP (tem))
168 window = Fcar (Fcdr (position)); 167 window = Fcar (Fcdr (position));
169 else 168 else
diff --git a/src/window.c b/src/window.c
index 721b4d98477..7fd66057ad2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4854,7 +4854,7 @@ specifies the window to scroll. This takes precedence over
4854 else 4854 else
4855 { 4855 {
4856 if (CONSP (arg)) 4856 if (CONSP (arg))
4857 arg = Fcar (arg); 4857 arg = XCAR (arg);
4858 CHECK_NUMBER (arg); 4858 CHECK_NUMBER (arg);
4859 window_scroll (window, XINT (arg), 0, 1); 4859 window_scroll (window, XINT (arg), 0, 1);
4860 } 4860 }
diff --git a/src/xmenu.c b/src/xmenu.c
index 5a6390449c4..fb03ab84d82 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -258,8 +258,7 @@ for instance using the window manager, then this produces a quit and
258 } 258 }
259 else if (CONSP (position)) 259 else if (CONSP (position))
260 { 260 {
261 Lisp_Object tem; 261 Lisp_Object tem = XCAR (position);
262 tem = Fcar (position);
263 if (CONSP (tem)) 262 if (CONSP (tem))
264 window = Fcar (Fcdr (position)); 263 window = Fcar (Fcdr (position));
265 else 264 else