Commit 3f4a9a5a authored by Paul Eggert's avatar Paul Eggert

Do not pdump user-defined hashtabs

* src/pdumper.c (dump_hash_table_stable_p):
Signal an error if a hash table has user-defined tests (Bug#36769).
* src/fns.c (hashfn_user_defined): Now extern.
parent c34496d0
Pipeline #2527 passed with stage
in 56 minutes and 15 seconds
......@@ -4017,7 +4017,7 @@ hashfn_eql (Lisp_Object key, struct Lisp_Hash_Table *h)
/* Given HT, return a hash code for KEY which uses a user-defined
function to compare keys. */
static Lisp_Object
Lisp_Object
hashfn_user_defined (Lisp_Object key, struct Lisp_Hash_Table *h)
{
Lisp_Object args[] = { h->test.user_hash_function, key };
......
......@@ -3606,6 +3606,7 @@ EMACS_UINT hash_string (char const *, ptrdiff_t);
EMACS_UINT sxhash (Lisp_Object, int);
Lisp_Object hashfn_eql (Lisp_Object, struct Lisp_Hash_Table *);
Lisp_Object hashfn_equal (Lisp_Object, struct Lisp_Hash_Table *);
Lisp_Object hashfn_user_defined (Lisp_Object, struct Lisp_Hash_Table *);
Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float,
Lisp_Object, bool);
ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object *);
......
......@@ -2628,6 +2628,8 @@ dump_vectorlike_generic (struct dump_context *ctx,
static bool
dump_hash_table_stable_p (const struct Lisp_Hash_Table *hash)
{
if (hash->test.hashfn == hashfn_user_defined)
error ("cannot dump hash tables with user-defined tests"); /* Bug#36769 */
bool is_eql = hash->test.hashfn == hashfn_eql;
bool is_equal = hash->test.hashfn == hashfn_equal;
ptrdiff_t size = HASH_TABLE_SIZE (hash);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment