1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 23:10:47 -08:00

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.
This commit is contained in:
Paul Eggert 2019-07-22 18:33:39 -07:00
parent c34496d0b9
commit 3f4a9a5a3b
3 changed files with 4 additions and 1 deletions

View file

@ -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 };

View file

@ -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 *);

View file

@ -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);