diff options
| author | Paul Eggert | 2018-12-08 22:53:15 -0800 |
|---|---|---|
| committer | Paul Eggert | 2018-12-08 22:54:11 -0800 |
| commit | fa4dd8dd01b87b751abd74408ddd581263d6b839 (patch) | |
| tree | a7337800a451fbe8a8f285ef783edee021c7a3dd /src | |
| parent | 7bcea8f8c11d10fd189c4250042dfe68e2df8c3a (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/alloc.c | 11 |
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 | ||
| 3339 | static 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 |