Commit 0c64a8cd authored by Kim F. Storm's avatar Kim F. Storm
Browse files

(wrong_type_argument): Remove loop around Fsignal.

(Farrayp, Fsequencep): Use ARRAYP.
(Fcar, Fcdr): Remove loop around wrong_type_argument.
(Fcar): Use CAR.
(Fcar_safe): Use CAR_SAFE.
(Fcdr): Use CDR.
(Fcdr_safe): Use CDR_SAFE.
(Fsetcar, Fsetcdr): Use CHECK_CONS.
(Fsubr_arity, Fsubr_name): Use CHECK_SUBR.
(Faset): Use CHECK_ARRAY.
parent 88674269
......@@ -113,18 +113,13 @@ Lisp_Object
wrong_type_argument (predicate, value)
register Lisp_Object predicate, value;
{
register Lisp_Object tem;
do
{
/* If VALUE is not even a valid Lisp object, abort here
where we can get a backtrace showing where it came from. */
if ((unsigned int) XGCTYPE (value) >= Lisp_Type_Limit)
abort ();
value = Fsignal (Qwrong_type_argument, Fcons (predicate, Fcons (value, Qnil)));
tem = call1 (predicate, value);
}
while (NILP (tem));
Fsignal (Qwrong_type_argument, list2 (predicate, value));
/* This function is marked as NO_RETURN, gcc would warn if it has a
return statement or if falls off the function. Other compilers
warn if no return statement is present. */
......@@ -394,8 +389,7 @@ DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
(object)
Lisp_Object object;
{
if (VECTORP (object) || STRINGP (object)
|| CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
if (ARRAYP (object))
return Qt;
return Qnil;
}
......@@ -405,8 +399,7 @@ DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
(object)
register Lisp_Object object;
{
if (CONSP (object) || NILP (object) || VECTORP (object) || STRINGP (object)
|| CHAR_TABLE_P (object) || BOOL_VECTOR_P (object))
if (CONSP (object) || NILP (object) || ARRAYP (object))
return Qt;
return Qnil;
}
......@@ -536,15 +529,7 @@ Lisp concepts such as car, cdr, cons cell and list. */)
(list)
register Lisp_Object list;
{
while (1)
{
if (CONSP (list))
return XCAR (list);
else if (EQ (list, Qnil))
return Qnil;
else
list = wrong_type_argument (Qlistp, list);
}
return CAR (list);
}
DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
......@@ -552,10 +537,7 @@ DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
(object)
Lisp_Object object;
{
if (CONSP (object))
return XCAR (object);
else
return Qnil;
return CAR_SAFE (object);
}
DEFUN ("cdr", Fcdr, Scdr, 1, 1, 0,
......@@ -567,15 +549,7 @@ Lisp concepts such as cdr, car, cons cell and list. */)
(list)
register Lisp_Object list;
{
while (1)
{
if (CONSP (list))
return XCDR (list);
else if (EQ (list, Qnil))
return Qnil;
else
list = wrong_type_argument (Qlistp, list);
}
return CDR (list);
}
DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
......@@ -583,10 +557,7 @@ DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
(object)
Lisp_Object object;
{
if (CONSP (object))
return XCDR (object);
else
return Qnil;
return CDR_SAFE (object);
}
DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
......@@ -594,9 +565,7 @@ DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
(cell, newcar)
register Lisp_Object cell, newcar;
{
if (!CONSP (cell))
cell = wrong_type_argument (Qconsp, cell);
CHECK_CONS (cell);
CHECK_IMPURE (cell);
XSETCAR (cell, newcar);
return newcar;
......@@ -607,9 +576,7 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
(cell, newcdr)
register Lisp_Object cell, newcdr;
{
if (!CONSP (cell))
cell = wrong_type_argument (Qconsp, cell);
CHECK_CONS (cell);
CHECK_IMPURE (cell);
XSETCDR (cell, newcdr);
return newcdr;
......@@ -764,8 +731,7 @@ function with `&rest' args, or `unevalled' for a special form. */)
Lisp_Object subr;
{
short minargs, maxargs;
if (!SUBRP (subr))
wrong_type_argument (Qsubrp, subr);
CHECK_SUBR (subr);
minargs = XSUBR (subr)->min_args;
maxargs = XSUBR (subr)->max_args;
if (maxargs == MANY)
......@@ -783,8 +749,7 @@ SUBR must be a built-in function. */)
Lisp_Object subr;
{
const char *name;
if (!SUBRP (subr))
wrong_type_argument (Qsubrp, subr);
CHECK_SUBR (subr);
name = XSUBR (subr)->symbol_name;
return make_string (name, strlen (name));
}
......@@ -2116,9 +2081,7 @@ bool-vector. IDX starts at 0. */)
CHECK_NUMBER (idx);
idxval = XINT (idx);
if (!VECTORP (array) && !STRINGP (array) && !BOOL_VECTOR_P (array)
&& ! CHAR_TABLE_P (array))
array = wrong_type_argument (Qarrayp, array);
CHECK_ARRAY (array, Qarrayp);
CHECK_IMPURE (array);
if (VECTORP (array))
......
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