aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
authorPaul Eggert2015-11-21 10:38:19 -0800
committerPaul Eggert2015-11-21 10:44:04 -0800
commit8afaa1321f8088bfb877fe4b6676e8517adb0bb7 (patch)
tree7e865f4b42fc44ba38abf7d0188db0aa05096fbd /src/lread.c
parentd696d62fea48096680d6d511a71c4df56d00a51f (diff)
downloademacs-8afaa1321f8088bfb877fe4b6676e8517adb0bb7.tar.gz
emacs-8afaa1321f8088bfb877fe4b6676e8517adb0bb7.zip
Add a few safety checks when ENABLE_CHECKING
This was motivated by the recent addition of module code, which added some ENABLE_CHECKING-enabled checks that are useful elsewhere too. * src/alloc.c (compact_font_cache_entry): * src/fns.c (sweep_weak_table): * src/lread.c (oblookup): Use gc_asize rather than doing it by hand. * src/emacs-module.c (module_make_global_ref) (module_free_global_ref, module_vec_size): Omit assertions that lisp.h now checks. * src/lisp.h (XFASTINT, ASIZE): In functional implementations, check that the result is nonnegative. Use eassume, as this info can help a bit when optimizing production code. (XSYMBOL) [!USE_LSB_TAG]: Assert that argument is a symbol, to be consistent with the USE_LSB_TAG case. (gc_asize): New function, when ASIZE is needed in the gc. (gc_aset): Use it. (HASH_TABLE_P): Move definition up, so that it can be used ... (XHASH_TABLE): ... here, to assert that the arg is a hash table.
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c
index a62a42ad1a9..7f0f1d1f6a8 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3941,10 +3941,8 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff
3941 Lisp_Object bucket, tem; 3941 Lisp_Object bucket, tem;
3942 3942
3943 obarray = check_obarray (obarray); 3943 obarray = check_obarray (obarray);
3944 obsize = ASIZE (obarray);
3945
3946 /* This is sometimes needed in the middle of GC. */ 3944 /* This is sometimes needed in the middle of GC. */
3947 obsize &= ~ARRAY_MARK_FLAG; 3945 obsize = gc_asize (obarray);
3948 hash = hash_string (ptr, size_byte) % obsize; 3946 hash = hash_string (ptr, size_byte) % obsize;
3949 bucket = AREF (obarray, hash); 3947 bucket = AREF (obarray, hash);
3950 oblookup_last_bucket_number = hash; 3948 oblookup_last_bucket_number = hash;