aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-11-15 02:05:04 +0000
committerKarl Heuer1994-11-15 02:05:04 +0000
commit6cb9cafb122bed8ba17617c6890dad6d55e0723c (patch)
treef7038859a850b71bea8ab6b92ed8593b1843c826 /src
parente202fa3405af38c0dd70f4146d8b796c86df3328 (diff)
downloademacs-6cb9cafb122bed8ba17617c6890dad6d55e0723c.tar.gz
emacs-6cb9cafb122bed8ba17617c6890dad6d55e0723c.zip
(internal_equal): Use new overlay substructure.
Simplify by returning int. (Fequal): Use new interface to internal_equal.
Diffstat (limited to 'src')
-rw-r--r--src/fns.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/src/fns.c b/src/fns.c
index d70d5e8daa8..e05afe1a776 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -37,7 +37,7 @@ extern Lisp_Object Flookup_key ();
37Lisp_Object Qstring_lessp, Qprovide, Qrequire; 37Lisp_Object Qstring_lessp, Qprovide, Qrequire;
38Lisp_Object Qyes_or_no_p_history; 38Lisp_Object Qyes_or_no_p_history;
39 39
40static Lisp_Object internal_equal (); 40static int internal_equal ();
41 41
42DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, 42DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
43 "Return the argument unchanged.") 43 "Return the argument unchanged.")
@@ -868,65 +868,72 @@ Symbols must match exactly.")
868 (o1, o2) 868 (o1, o2)
869 register Lisp_Object o1, o2; 869 register Lisp_Object o1, o2;
870{ 870{
871 return internal_equal (o1, o2, 0); 871 return internal_equal (o1, o2, 0) ? Qt : Qnil;
872} 872}
873 873
874static Lisp_Object 874static int
875internal_equal (o1, o2, depth) 875internal_equal (o1, o2, depth)
876 register Lisp_Object o1, o2; 876 register Lisp_Object o1, o2;
877 int depth; 877 int depth;
878{ 878{
879 if (depth > 200) 879 if (depth > 200)
880 error ("Stack overflow in equal"); 880 error ("Stack overflow in equal");
881do_cdr: 881 tail_recurse:
882 QUIT; 882 QUIT;
883 if (EQ (o1, o2)) return Qt; 883 if (EQ (o1, o2)) return 1;
884#ifdef LISP_FLOAT_TYPE 884#ifdef LISP_FLOAT_TYPE
885 if (FLOATP (o1) && FLOATP (o2)) 885 if (FLOATP (o1) && FLOATP (o2))
886 return (extract_float (o1) == extract_float (o2)) ? Qt : Qnil; 886 return (extract_float (o1) == extract_float (o2));
887#endif 887#endif
888 if (XTYPE (o1) != XTYPE (o2)) return Qnil; 888 if (XTYPE (o1) != XTYPE (o2)) return 0;
889 if (MISCP (o1) && XMISC (o1)->type != XMISC (o2)->type) return Qnil; 889 if (MISCP (o1) && XMISC (o1)->type != XMISC (o2)->type) return 0;
890 if (CONSP (o1) || OVERLAYP (o1)) 890 if (CONSP (o1))
891 {
892 if (!internal_equal (XCONS (o1)->car, XCONS (o2)->car, depth + 1))
893 return 0;
894 o1 = XCONS (o1)->cdr;
895 o2 = XCONS (o2)->cdr;
896 goto tail_recurse;
897 }
898 if (OVERLAYP (o1))
891 { 899 {
892 Lisp_Object v1; 900 if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o1), depth + 1)
893 v1 = internal_equal (Fcar (o1), Fcar (o2), depth + 1); 901 || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o1), depth + 1))
894 if (NILP (v1)) 902 return 0;
895 return v1; 903 o1 = XOVERLAY (o1)->plist;
896 o1 = Fcdr (o1), o2 = Fcdr (o2); 904 o2 = XOVERLAY (o2)->plist;
897 goto do_cdr; 905 goto tail_recurse;
898 } 906 }
899 if (MARKERP (o1)) 907 if (MARKERP (o1))
900 { 908 {
901 return ((XMARKER (o1)->buffer == XMARKER (o2)->buffer 909 return (XMARKER (o1)->buffer == XMARKER (o2)->buffer
902 && (XMARKER (o1)->buffer == 0 910 && (XMARKER (o1)->buffer == 0
903 || XMARKER (o1)->bufpos == XMARKER (o2)->bufpos)) 911 || XMARKER (o1)->bufpos == XMARKER (o2)->bufpos));
904 ? Qt : Qnil);
905 } 912 }
906 if (VECTORP (o1) || COMPILEDP (o1)) 913 if (VECTORP (o1) || COMPILEDP (o1))
907 { 914 {
908 register int index; 915 register int index;
909 if (XVECTOR (o1)->size != XVECTOR (o2)->size) 916 if (XVECTOR (o1)->size != XVECTOR (o2)->size)
910 return Qnil; 917 return 0;
911 for (index = 0; index < XVECTOR (o1)->size; index++) 918 for (index = 0; index < XVECTOR (o1)->size; index++)
912 { 919 {
913 Lisp_Object v, v1, v2; 920 Lisp_Object v1, v2;
914 v1 = XVECTOR (o1)->contents [index]; 921 v1 = XVECTOR (o1)->contents [index];
915 v2 = XVECTOR (o2)->contents [index]; 922 v2 = XVECTOR (o2)->contents [index];
916 v = internal_equal (v1, v2, depth + 1); 923 if (!internal_equal (v1, v2, depth + 1))
917 if (NILP (v)) return v; 924 return 0;
918 } 925 }
919 return Qt; 926 return 1;
920 } 927 }
921 if (STRINGP (o1)) 928 if (STRINGP (o1))
922 { 929 {
923 if (XSTRING (o1)->size != XSTRING (o2)->size) 930 if (XSTRING (o1)->size != XSTRING (o2)->size)
924 return Qnil; 931 return 0;
925 if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data, XSTRING (o1)->size)) 932 if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data, XSTRING (o1)->size))
926 return Qnil; 933 return 0;
927 return Qt; 934 return 1;
928 } 935 }
929 return Qnil; 936 return 0;
930} 937}
931 938
932DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, 939DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0,