diff options
| author | Mattias EngdegÄrd | 2024-01-31 12:21:12 +0100 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-01-31 12:48:48 +0100 |
| commit | 7e85311a9113a4720ec9d7b06188646fc7bdae0b (patch) | |
| tree | 119807ece0bb2bf2cac2fedce27c331a27092da8 /src | |
| parent | 5f24c9a4c82f7106e22cac8a5201db8307239837 (diff) | |
| download | emacs-7e85311a9113a4720ec9d7b06188646fc7bdae0b.tar.gz emacs-7e85311a9113a4720ec9d7b06188646fc7bdae0b.zip | |
Allow equal user-defined hash table tests with different names
Hash tables using different user-defined tests defined identically
sometimes ended up using the wrong test (bug#68668).
* src/fns.c (get_hash_table_user_test): Take test name into account
when matching the test object.
* test/src/fns-tests.el (fns--define-hash-table-test): New.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -5374,6 +5374,8 @@ mark_fns (void) | |||
| 5374 | } | 5374 | } |
| 5375 | } | 5375 | } |
| 5376 | 5376 | ||
| 5377 | /* Find the hash_table_test object correponding to the (bare) symbol TEST, | ||
| 5378 | creating one if none existed. */ | ||
| 5377 | static struct hash_table_test * | 5379 | static struct hash_table_test * |
| 5378 | get_hash_table_user_test (Lisp_Object test) | 5380 | get_hash_table_user_test (Lisp_Object test) |
| 5379 | { | 5381 | { |
| @@ -5384,7 +5386,8 @@ get_hash_table_user_test (Lisp_Object test) | |||
| 5384 | Lisp_Object equal_fn = XCAR (prop); | 5386 | Lisp_Object equal_fn = XCAR (prop); |
| 5385 | Lisp_Object hash_fn = XCAR (XCDR (prop)); | 5387 | Lisp_Object hash_fn = XCAR (XCDR (prop)); |
| 5386 | struct hash_table_user_test *ut = hash_table_user_tests; | 5388 | struct hash_table_user_test *ut = hash_table_user_tests; |
| 5387 | while (ut && !(EQ (equal_fn, ut->test.user_cmp_function) | 5389 | while (ut && !(BASE_EQ (test, ut->test.name) |
| 5390 | && EQ (equal_fn, ut->test.user_cmp_function) | ||
| 5388 | && EQ (hash_fn, ut->test.user_hash_function))) | 5391 | && EQ (hash_fn, ut->test.user_hash_function))) |
| 5389 | ut = ut->next; | 5392 | ut = ut->next; |
| 5390 | if (!ut) | 5393 | if (!ut) |