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