diff src/fns.c @ 90408:cc49fe5026c6

(assoc_no_quit): New function.
author Kenichi Handa <handa@m17n.org>
date Tue, 06 Jun 2006 03:51:12 +0000
parents c156f6a9e7b5
children a8190f7e546e
line wrap: on
line diff
--- a/src/fns.c	Tue Jun 06 03:50:58 2006 +0000
+++ b/src/fns.c	Tue Jun 06 03:51:12 2006 +0000
@@ -1524,6 +1524,22 @@
   return result;
 }
 
+/* Like Fassoc but never report an error and do not allow quits.
+   Use only on lists known never to be circular.  */
+
+Lisp_Object
+assoc_no_quit (key, list)
+     Lisp_Object key, list;
+{
+  while (CONSP (list)
+	 && (!CONSP (XCAR (list))
+	     || (!EQ (XCAR (XCAR (list)), key)
+		 && NILP (Fequal (XCAR (XCAR (list)), key)))))
+    list = XCDR (list);
+
+  return CONSP (list) ? XCAR (list) : Qnil;
+}
+
 DEFUN ("rassq", Frassq, Srassq, 2, 2, 0,
        doc: /* Return non-nil if KEY is `eq' to the cdr of an element of LIST.
 The value is actually the first element of LIST whose cdr is KEY.  */)