changeset 399:21aa17a1560d

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 17 Aug 1991 17:54:46 +0000
parents a60eafebd43f
children 10994e910591
files src/fns.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/fns.c	Fri Aug 16 16:09:27 1991 +0000
+++ b/src/fns.c	Sat Aug 17 17:54:46 1991 +0000
@@ -74,6 +74,8 @@
 
 Lisp_Object Qstring_lessp;
 
+static Lisp_Object internal_equal ();
+
 DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
   "Return the argument unchanged.")
   (arg)
@@ -483,8 +485,8 @@
     {
       if (XTYPE (seq) == Lisp_Cons || NULL (seq))
 	return Fcar (Fnthcdr (n, seq));
-      else if (XTYPE (seq) == Lisp_String ||
-	       XTYPE (seq) == Lisp_Vector)
+      else if (XTYPE (seq) == Lisp_String
+	       || XTYPE (seq) == Lisp_Vector)
 	return Faref (seq, n);
       else
 	seq = wrong_type_argument (Qsequencep, seq);
@@ -830,6 +832,16 @@
   (o1, o2)
      register Lisp_Object o1, o2;
 {
+  return internal_equal (o1, o2, 0);
+}
+
+static Lisp_Object
+internal_equal (o1, o2, depth)
+     register Lisp_Object o1, o2;
+     int depth;
+{
+  if (depth > 200)
+    error ("Stack overflow in equal");
 do_cdr:
   QUIT;
   if (XTYPE (o1) != XTYPE (o2)) return Qnil;
@@ -837,7 +849,7 @@
   if (XTYPE (o1) == Lisp_Cons)
     {
       Lisp_Object v1;
-      v1 = Fequal (Fcar (o1), Fcar (o2));
+      v1 = Fequal (Fcar (o1), Fcar (o2), depth + 1);
       if (NULL (v1))
 	return v1;
       o1 = Fcdr (o1), o2 = Fcdr (o2);
@@ -859,7 +871,7 @@
 	  Lisp_Object v, v1, v2;
 	  v1 = XVECTOR (o1)->contents [index];
 	  v2 = XVECTOR (o2)->contents [index];
-	  v = Fequal (v1, v2);
+	  v = Fequal (v1, v2, depth + 1);
 	  if (NULL (v)) return v;
 	}
       return Qt;