emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7dfe682: * src/fns.c (sxhash): Fix records hashing


From: Stefan Monnier
Subject: [Emacs-diffs] master 7dfe682: * src/fns.c (sxhash): Fix records hashing (bug#27057, bug#26639)
Date: Wed, 24 May 2017 11:55:19 -0400 (EDT)

branch: master
commit 7dfe682ee7e905b6e3d4513e7cef0798bc2de0f0
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * src/fns.c (sxhash): Fix records hashing (bug#27057, bug#26639)
    
    (sxhash_vector): Make it work on pseudo vectors as well.
    (sxhash): Treat records like vectors.
---
 src/fns.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/fns.c b/src/fns.c
index 0332ab5..6610d2a 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4289,7 +4289,7 @@ sxhash_list (Lisp_Object list, int depth)
 }
 
 
-/* Return a hash for vector VECTOR.  DEPTH is the current depth in
+/* Return a hash for (pseudo)vector VECTOR.  DEPTH is the current depth in
    the Lisp structure.  */
 
 static EMACS_UINT
@@ -4298,7 +4298,7 @@ sxhash_vector (Lisp_Object vec, int depth)
   EMACS_UINT hash = ASIZE (vec);
   int i, n;
 
-  n = min (SXHASH_MAX_LEN, ASIZE (vec));
+  n = min (SXHASH_MAX_LEN, hash & PSEUDOVECTOR_FLAG ? PVSIZE (vec) : hash);
   for (i = 0; i < n; ++i)
     {
       EMACS_UINT hash2 = sxhash (AREF (vec, i), depth + 1);
@@ -4353,11 +4353,11 @@ sxhash (Lisp_Object obj, int depth)
 
       /* This can be everything from a vector to an overlay.  */
     case Lisp_Vectorlike:
-      if (VECTORP (obj))
+      if (VECTORP (obj) || RECORDP (obj))
        /* According to the CL HyperSpec, two arrays are equal only if
           they are `eq', except for strings and bit-vectors.  In
           Emacs, this works differently.  We have to compare element
-          by element.  */
+          by element.  Same for records.  */
        hash = sxhash_vector (obj, depth);
       else if (BOOL_VECTOR_P (obj))
        hash = sxhash_bool_vector (obj);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]