Remove CHECK_FIXNUM_CAR etc.

* src/coding.c (CHECK_FIXNAT_CAR, CHECK_FIXNAT_CDR):
* src/lisp.h (CHECK_FIXNUM_CAR, CHECK_FIXNUM_CDR):
Remove.  All uses removed.  These seem to have been based on
the assumption that the argument cons needs to be modified,
an assumption that is incorrect for fixnums.
(Fdefine_coding_system_internal): Use CHECK_RANGED_INTEGER
instead of a special diagnostic for graphic register numbers.
This commit is contained in:
Paul Eggert 2018-12-09 17:07:16 -08:00
parent 87bc518afc
commit 48d7720993
4 changed files with 15 additions and 60 deletions

View file

@ -617,23 +617,7 @@ inhibit_flag (int encoded_flag, bool var)
do { \
(attrs) = CODING_ID_ATTRS ((coding)->id); \
(charset_list) = CODING_ATTR_CHARSET_LIST (attrs); \
} while (0)
static void
CHECK_FIXNAT_CAR (Lisp_Object x)
{
Lisp_Object tmp = XCAR (x);
CHECK_FIXNAT (tmp);
XSETCAR (x, tmp);
}
static void
CHECK_FIXNAT_CDR (Lisp_Object x)
{
Lisp_Object tmp = XCDR (x);
CHECK_FIXNAT (tmp);
XSETCDR (x, tmp);
}
} while (false)
/* True if CODING's destination can be grown. */
@ -10271,15 +10255,9 @@ usage: (define-coding-system-internal ...) */)
else
{
CHECK_CONS (val);
CHECK_FIXNAT_CAR (val);
CHECK_FIXNUM_CDR (val);
if (XFIXNUM (XCAR (val)) > 255)
args_out_of_range_3 (XCAR (val),
make_fixnum (0), make_fixnum (255));
CHECK_RANGED_INTEGER (XCAR (val), 0, 255);
from = XFIXNUM (XCAR (val));
if (! (from <= XFIXNUM (XCDR (val)) && XFIXNUM (XCDR (val)) <= 255))
args_out_of_range_3 (XCDR (val),
XCAR (val), make_fixnum (255));
CHECK_RANGED_INTEGER (XCDR (val), from, 255);
to = XFIXNUM (XCDR (val));
}
for (int i = from; i <= to; i++)
@ -10354,23 +10332,18 @@ usage: (define-coding-system-internal ...) */)
reg_usage = args[coding_arg_iso2022_reg_usage];
CHECK_CONS (reg_usage);
CHECK_FIXNUM_CAR (reg_usage);
CHECK_FIXNUM_CDR (reg_usage);
CHECK_FIXNUM (XCAR (reg_usage));
CHECK_FIXNUM (XCDR (reg_usage));
request = Fcopy_sequence (args[coding_arg_iso2022_request]);
for (Lisp_Object tail = request; CONSP (tail); tail = XCDR (tail))
{
int id;
Lisp_Object tmp1;
val = XCAR (tail);
CHECK_CONS (val);
tmp1 = XCAR (val);
CHECK_CHARSET_GET_ID (tmp1, id);
CHECK_FIXNAT_CDR (val);
if (XFIXNUM (XCDR (val)) >= 4)
error ("Invalid graphic register number: %"pI"d",
XFIXNUM (XCDR (val)));
CHECK_CHARSET_GET_ID (XCAR (val), id);
CHECK_RANGED_INTEGER (XCDR (val), 0, 3);
XSETCAR (val, make_fixnum (id));
}

View file

@ -1756,14 +1756,14 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
CHECK_FIXNUM_COERCE_MARKER (from);
CHECK_CONS (frompos);
CHECK_FIXNUM_CAR (frompos);
CHECK_FIXNUM_CDR (frompos);
CHECK_FIXNUM (XCAR (frompos));
CHECK_FIXNUM (XCDR (frompos));
CHECK_FIXNUM_COERCE_MARKER (to);
if (!NILP (topos))
{
CHECK_CONS (topos);
CHECK_FIXNUM_CAR (topos);
CHECK_FIXNUM_CDR (topos);
CHECK_FIXNUM (XCAR (topos));
CHECK_FIXNUM (XCDR (topos));
}
if (!NILP (width))
CHECK_FIXNUM (width);
@ -1771,8 +1771,8 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */)
if (!NILP (offsets))
{
CHECK_CONS (offsets);
CHECK_FIXNUM_CAR (offsets);
CHECK_FIXNUM_CDR (offsets);
CHECK_FIXNUM (XCAR (offsets));
CHECK_FIXNUM (XCDR (offsets));
if (! (0 <= XFIXNUM (XCAR (offsets)) && XFIXNUM (XCAR (offsets)) <= PTRDIFF_MAX
&& 0 <= XFIXNUM (XCDR (offsets)) && XFIXNUM (XCDR (offsets)) <= INT_MAX))
args_out_of_range (XCAR (offsets), XCDR (offsets));

View file

@ -2906,24 +2906,6 @@ CHECK_INTEGER (Lisp_Object x)
else \
CHECK_TYPE (INTEGERP (x), Qnumber_or_marker_p, x); \
} while (false)
/* Since we can't assign directly to the CAR or CDR fields of a cons
cell, use these when checking that those fields contain numbers. */
INLINE void
CHECK_FIXNUM_CAR (Lisp_Object x)
{
Lisp_Object tmp = XCAR (x);
CHECK_FIXNUM (tmp);
XSETCAR (x, tmp);
}
INLINE void
CHECK_FIXNUM_CDR (Lisp_Object x)
{
Lisp_Object tmp = XCDR (x);
CHECK_FIXNUM (tmp);
XSETCDR (x, tmp);
}
/* Define a built-in function for calling from Lisp.
`lname' should be the name to give the function in Lisp,

View file

@ -3476,8 +3476,8 @@ If successful, the new layout id is returned, otherwise nil. */)
HKL kl;
CHECK_CONS (layout);
CHECK_FIXNUM_CAR (layout);
CHECK_FIXNUM_CDR (layout);
CHECK_FIXNUM (XCAR (layout));
CHECK_FIXNUM (XCDR (layout));
kl = (HKL) (UINT_PTR) ((XFIXNUM (XCAR (layout)) & 0xffff)
| (XFIXNUM (XCDR (layout)) << 16));