aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2017-05-24 11:55:13 -0400
committerStefan Monnier2017-05-24 11:55:13 -0400
commit7dfe682ee7e905b6e3d4513e7cef0798bc2de0f0 (patch)
tree721c072d2c74066c56509cd5008988f914daf232
parentac36012dc2e751788861b37e77f99d66c4da352a (diff)
downloademacs-7dfe682ee7e905b6e3d4513e7cef0798bc2de0f0.tar.gz
emacs-7dfe682ee7e905b6e3d4513e7cef0798bc2de0f0.zip
* 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.
-rw-r--r--src/fns.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fns.c b/src/fns.c
index 0332ab5dad0..6610d2a6d0e 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4289,7 +4289,7 @@ sxhash_list (Lisp_Object list, int depth)
4289} 4289}
4290 4290
4291 4291
4292/* Return a hash for vector VECTOR. DEPTH is the current depth in 4292/* Return a hash for (pseudo)vector VECTOR. DEPTH is the current depth in
4293 the Lisp structure. */ 4293 the Lisp structure. */
4294 4294
4295static EMACS_UINT 4295static EMACS_UINT
@@ -4298,7 +4298,7 @@ sxhash_vector (Lisp_Object vec, int depth)
4298 EMACS_UINT hash = ASIZE (vec); 4298 EMACS_UINT hash = ASIZE (vec);
4299 int i, n; 4299 int i, n;
4300 4300
4301 n = min (SXHASH_MAX_LEN, ASIZE (vec)); 4301 n = min (SXHASH_MAX_LEN, hash & PSEUDOVECTOR_FLAG ? PVSIZE (vec) : hash);
4302 for (i = 0; i < n; ++i) 4302 for (i = 0; i < n; ++i)
4303 { 4303 {
4304 EMACS_UINT hash2 = sxhash (AREF (vec, i), depth + 1); 4304 EMACS_UINT hash2 = sxhash (AREF (vec, i), depth + 1);
@@ -4353,11 +4353,11 @@ sxhash (Lisp_Object obj, int depth)
4353 4353
4354 /* This can be everything from a vector to an overlay. */ 4354 /* This can be everything from a vector to an overlay. */
4355 case Lisp_Vectorlike: 4355 case Lisp_Vectorlike:
4356 if (VECTORP (obj)) 4356 if (VECTORP (obj) || RECORDP (obj))
4357 /* According to the CL HyperSpec, two arrays are equal only if 4357 /* According to the CL HyperSpec, two arrays are equal only if
4358 they are `eq', except for strings and bit-vectors. In 4358 they are `eq', except for strings and bit-vectors. In
4359 Emacs, this works differently. We have to compare element 4359 Emacs, this works differently. We have to compare element
4360 by element. */ 4360 by element. Same for records. */
4361 hash = sxhash_vector (obj, depth); 4361 hash = sxhash_vector (obj, depth);
4362 else if (BOOL_VECTOR_P (obj)) 4362 else if (BOOL_VECTOR_P (obj))
4363 hash = sxhash_bool_vector (obj); 4363 hash = sxhash_bool_vector (obj);