aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorPaul Eggert2018-12-08 22:53:15 -0800
committerPaul Eggert2018-12-08 22:54:11 -0800
commitfa4dd8dd01b87b751abd74408ddd581263d6b839 (patch)
treea7337800a451fbe8a8f285ef783edee021c7a3dd /src/alloc.c
parent7bcea8f8c11d10fd189c4250042dfe68e2df8c3a (diff)
downloademacs-fa4dd8dd01b87b751abd74408ddd581263d6b839.tar.gz
emacs-fa4dd8dd01b87b751abd74408ddd581263d6b839.zip
Port VECTOR_ELTS_MAX to older GCC etc.
Problem reported by Eli Zaretskii in: https://lists.gnu.org/r/emacs-devel/2018-12/msg00182.html * src/alloc.c (VECTOR_ELTS_MAX): Now a macro. Needed for portability to older GCC and non-GCC.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 3bc9277a7b2..d34b34f27d8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3336,10 +3336,13 @@ sweep_vectors (void)
3336 } 3336 }
3337} 3337}
3338 3338
3339static ptrdiff_t const VECTOR_ELTS_MAX 3339/* Maximum number of elements in a vector. This is a macro so that it
3340 = min (((min (PTRDIFF_MAX, SIZE_MAX) - header_size - large_vector_offset) 3340 can be used in an integer constant expression. */
3341 / word_size), 3341
3342 MOST_POSITIVE_FIXNUM); 3342#define VECTOR_ELTS_MAX \
3343 min (((min (PTRDIFF_MAX, SIZE_MAX) - header_size - large_vector_offset) \
3344 / word_size), \
3345 MOST_POSITIVE_FIXNUM)
3343 3346
3344/* Value is a pointer to a newly allocated Lisp_Vector structure 3347/* Value is a pointer to a newly allocated Lisp_Vector structure
3345 with room for LEN Lisp_Objects. LEN must be positive and 3348 with room for LEN Lisp_Objects. LEN must be positive and