Commit 7d7bbefd authored by Dmitry Antipov's avatar Dmitry Antipov

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.
parent 3a4c8000
2012-07-10 Dmitry Antipov <dmantipov@yandex.ru>
* coccinelle/list_loop.cocci: Semantic patch to convert from Fcdr
to XCDR and consistently use CONSP in the list iteration loops.
* coccinelle/vector_contents.cocci: Fix indentation.
2012-07-10 Stefan Monnier <monnier@iro.umontreal.ca>
* bzrmerge.el: Use cl-lib.
......
// 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
)
......@@ -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)
)
2012-07-10 Dmitry Antipov <dmantipov@yandex.ru>
Use XCAR and XCDR instead of Fcar and Fcdr where possible.
* callint.c, coding.c, doc.c, editfns.c, eval.c, font.c, fontset.c,
* frame.c, gnutls.c, minibuf.c, msdos.c, textprop.c, w32fns.c,
* w32menu.c, window.c, xmenu.c: Changed to use XCAR and XCDR
where argument type is known to be a Lisp_Cons.
2012-07-10 Tom Tromey <tromey@redhat.com>
* bytecode.c (BYTE_CODE_THREADED): New macro.
......
......@@ -205,7 +205,7 @@ fix_command (Lisp_Object input, Lisp_Object values)
if (CONSP (elt))
{
Lisp_Object presflag, carelt;
carelt = Fcar (elt);
carelt = XCAR (elt);
/* If it is (if X Y), look at Y. */
if (EQ (carelt, Qif)
&& EQ (Fnthcdr (make_number (3), elt), Qnil))
......
......@@ -9791,7 +9791,7 @@ usage: (define-coding-system-internal ...) */)
val = args[coding_arg_ccl_valids];
valids = Fmake_string (make_number (256), make_number (0));
for (tail = val; !NILP (tail); tail = Fcdr (tail))
for (tail = val; CONSP (tail); tail = XCDR (tail))
{
int from, to;
......@@ -9892,7 +9892,7 @@ usage: (define-coding-system-internal ...) */)
CHECK_NUMBER_CDR (reg_usage);
request = Fcopy_sequence (args[coding_arg_iso2022_request]);
for (tail = request; ! NILP (tail); tail = Fcdr (tail))
for (tail = request; CONSP (tail); tail = XCDR (tail))
{
int id;
Lisp_Object tmp1;
......
......@@ -381,7 +381,7 @@ string is passed through `substitute-command-keys'. */)
}
else if (CONSP (fun))
{
funcar = Fcar (fun);
funcar = XCAR (fun);
if (!SYMBOLP (funcar))
xsignal1 (Qinvalid_function, fun);
else if (EQ (funcar, Qkeymap))
......
......@@ -1915,7 +1915,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
tm.tm_isdst = -1;
if (CONSP (zone))
zone = Fcar (zone);
zone = XCAR (zone);
if (NILP (zone))
{
BLOCK_INPUT;
......
......@@ -2070,8 +2070,8 @@ eval_sub (Lisp_Object form)
error ("Lisp nesting exceeds `max-lisp-eval-depth'");
}
original_fun = Fcar (form);
original_args = Fcdr (form);
original_fun = XCAR (form);
original_args = XCDR (form);
backtrace.next = backtrace_list;
backtrace_list = &backtrace;
......
......@@ -1827,7 +1827,7 @@ check_otf_features (Lisp_Object otf_features)
CHECK_CONS (otf_features);
CHECK_SYMBOL (XCAR (otf_features));
otf_features = XCDR (otf_features);
for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val))
for (val = Fcar (otf_features); CONSP (val); val = XCDR (val))
{
CHECK_SYMBOL (Fcar (val));
if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4)
......@@ -1835,7 +1835,7 @@ check_otf_features (Lisp_Object otf_features)
SDATA (SYMBOL_NAME (XCAR (val))));
}
otf_features = XCDR (otf_features);
for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val))
for (val = Fcar (otf_features); CONSP (val); val = XCDR (val))
{
CHECK_SYMBOL (Fcar (val));
if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4)
......
......@@ -1668,7 +1668,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of
Fset_char_table_range (fontset, Qt, Qnil);
}
for (; ! NILP (fontlist); fontlist = Fcdr (fontlist))
for (; CONSP (fontlist); fontlist = XCDR (fontlist))
{
Lisp_Object elt, script;
......
......@@ -2754,7 +2754,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
struct gcpro gcpro1, gcpro2;
i = 0;
for (tail = alist; CONSP (tail); tail = Fcdr (tail))
for (tail = alist; CONSP (tail); tail = XCDR (tail))
i++;
parms = alloca (i * sizeof *parms);
......
......@@ -871,7 +871,7 @@ one trustfile (usually a CA bundle). */)
int file_format = GNUTLS_X509_FMT_PEM;
Lisp_Object tail;
for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail))
for (tail = trustfiles; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object trustfile = Fcar (tail);
if (STRINGP (trustfile))
......@@ -893,7 +893,7 @@ one trustfile (usually a CA bundle). */)
}
}
for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail))
for (tail = crlfiles; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object crlfile = Fcar (tail);
if (STRINGP (crlfile))
......@@ -913,7 +913,7 @@ one trustfile (usually a CA bundle). */)
}
}
for (tail = keylist; !NILP (tail); tail = Fcdr (tail))
for (tail = keylist; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object keyfile = Fcar (Fcar (tail));
Lisp_Object certfile = Fcar (Fcdr (tail));
......
......@@ -425,7 +425,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
if (CONSP (initial))
{
Lisp_Object backup_n = Fcdr (initial);
initial = Fcar (initial);
initial = XCAR (initial);
CHECK_STRING (initial);
if (!NILP (backup_n))
{
......
......@@ -1618,7 +1618,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
/* Extract parm names and values into those vectors. */
i = 0;
for (tail = alist; CONSP (tail); tail = Fcdr (tail))
for (tail = alist; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object elt;
......
......@@ -271,7 +271,7 @@ interval_has_some_properties_list (Lisp_Object list, INTERVAL i)
/* Go through each element of LIST. */
for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1))
{
sym = Fcar (tail1);
sym = XCAR (tail1);
/* Go through i's plist, looking for tail1 */
for (tail2 = i->plist; CONSP (tail2); tail2 = XCDR (XCDR (tail2)))
......
......@@ -678,7 +678,7 @@ w32_color_map_lookup (char *colorname)
elt = XCAR (tail);
if (!CONSP (elt)) continue;
tem = Fcar (elt);
tem = XCAR (elt);
if (lstrcmpi (SDATA (tem), colorname) == 0)
{
......
......@@ -162,8 +162,7 @@ otherwise it is "Question". */)
}
else if (CONSP (position))
{
Lisp_Object tem;
tem = Fcar (position);
Lisp_Object tem = XCAR (position);
if (CONSP (tem))
window = Fcar (Fcdr (position));
else
......
......@@ -4854,7 +4854,7 @@ specifies the window to scroll. This takes precedence over
else
{
if (CONSP (arg))
arg = Fcar (arg);
arg = XCAR (arg);
CHECK_NUMBER (arg);
window_scroll (window, XINT (arg), 0, 1);
}
......
......@@ -258,8 +258,7 @@ for instance using the window manager, then this produces a quit and
}
else if (CONSP (position))
{
Lisp_Object tem;
tem = Fcar (position);
Lisp_Object tem = XCAR (position);
if (CONSP (tem))
window = Fcar (Fcdr (position));
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment