diff options
| author | Michael R. Mauger | 2017-07-24 22:15:04 -0400 |
|---|---|---|
| committer | Michael R. Mauger | 2017-07-24 22:15:04 -0400 |
| commit | df1a71272e5cdd10b511e2ffd702ca50ddd8a773 (patch) | |
| tree | 9b9ac725394ee80891e2bff57b6407d0e491e71a /src/emacs-module.c | |
| parent | eb27fc4d49e8c914cd0e6a8a2d02159601542141 (diff) | |
| parent | 32daa3cb54523006c88717cbeac87964cd687a1b (diff) | |
| download | emacs-df1a71272e5cdd10b511e2ffd702ca50ddd8a773.tar.gz emacs-df1a71272e5cdd10b511e2ffd702ca50ddd8a773.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src/emacs-module.c')
| -rw-r--r-- | src/emacs-module.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index 7b1a402eeff..ad6c8fb0104 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -315,20 +315,18 @@ module_free_global_ref (emacs_env *env, emacs_value ref) | |||
| 315 | MODULE_FUNCTION_BEGIN (); | 315 | MODULE_FUNCTION_BEGIN (); |
| 316 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); | 316 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash); |
| 317 | Lisp_Object obj = value_to_lisp (ref); | 317 | Lisp_Object obj = value_to_lisp (ref); |
| 318 | EMACS_UINT hashcode; | 318 | ptrdiff_t i = hash_lookup (h, obj, NULL); |
| 319 | ptrdiff_t i = hash_lookup (h, obj, &hashcode); | ||
| 320 | 319 | ||
| 321 | if (i >= 0) | 320 | if (i >= 0) |
| 322 | { | 321 | { |
| 323 | Lisp_Object value = HASH_VALUE (h, i); | 322 | EMACS_INT refcount = XFASTINT (HASH_VALUE (h, i)) - 1; |
| 324 | EMACS_INT refcount = XFASTINT (value) - 1; | ||
| 325 | if (refcount > 0) | 323 | if (refcount > 0) |
| 324 | set_hash_value_slot (h, i, make_natnum (refcount)); | ||
| 325 | else | ||
| 326 | { | 326 | { |
| 327 | value = make_natnum (refcount); | 327 | eassert (refcount == 0); |
| 328 | set_hash_value_slot (h, i, value); | 328 | hash_remove_from_table (h, obj); |
| 329 | } | 329 | } |
| 330 | else | ||
| 331 | hash_remove_from_table (h, value); | ||
| 332 | } | 330 | } |
| 333 | 331 | ||
| 334 | if (module_assertions) | 332 | if (module_assertions) |
| @@ -817,9 +815,13 @@ in_current_thread (void) | |||
| 817 | static void | 815 | static void |
| 818 | module_assert_thread (void) | 816 | module_assert_thread (void) |
| 819 | { | 817 | { |
| 820 | if (! module_assertions || in_current_thread ()) | 818 | if (!module_assertions) |
| 821 | return; | 819 | return; |
| 822 | module_abort ("Module function called from outside the current Lisp thread"); | 820 | if (!in_current_thread ()) |
| 821 | module_abort ("Module function called from outside " | ||
| 822 | "the current Lisp thread"); | ||
| 823 | if (gc_in_progress) | ||
| 824 | module_abort ("Module function called during garbage collection"); | ||
| 823 | } | 825 | } |
| 824 | 826 | ||
| 825 | static void | 827 | static void |