diff options
| author | Paul Eggert | 2018-08-30 18:10:18 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-30 18:10:56 -0700 |
| commit | 7c0675af3c9aa7971c37aa9e7afdceae6bfea767 (patch) | |
| tree | 8d1cd73a60f9437f4768876a104c272ab8a09520 /src | |
| parent | 15006cf1dd9ec873c4b1cad1ba1bacf0a5b6229d (diff) | |
| download | emacs-7c0675af3c9aa7971c37aa9e7afdceae6bfea767.tar.gz emacs-7c0675af3c9aa7971c37aa9e7afdceae6bfea767.zip | |
Fix bignum FIXME in emacs-module.c
* src/emacs-module.c: Do not include bignum.h; no longer needed.
(module_extract_integer): Use bignum_to_intmax to avoid
incorrectly signaling overflow on platforms where intmax_t
is wider than long int.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs-module.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c index cf92b0fdb51..2ba5540d9a1 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -27,7 +27,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 27 | #include <stdio.h> | 27 | #include <stdio.h> |
| 28 | 28 | ||
| 29 | #include "lisp.h" | 29 | #include "lisp.h" |
| 30 | #include "bignum.h" | ||
| 31 | #include "dynlib.h" | 30 | #include "dynlib.h" |
| 32 | #include "coding.h" | 31 | #include "coding.h" |
| 33 | #include "keyboard.h" | 32 | #include "keyboard.h" |
| @@ -522,11 +521,10 @@ module_extract_integer (emacs_env *env, emacs_value n) | |||
| 522 | CHECK_INTEGER (l); | 521 | CHECK_INTEGER (l); |
| 523 | if (BIGNUMP (l)) | 522 | if (BIGNUMP (l)) |
| 524 | { | 523 | { |
| 525 | /* FIXME: This can incorrectly signal overflow on platforms | 524 | intmax_t i = bignum_to_intmax (l); |
| 526 | where long is narrower than intmax_t. */ | 525 | if (i == 0) |
| 527 | if (!mpz_fits_slong_p (XBIGNUM (l)->value)) | ||
| 528 | xsignal1 (Qoverflow_error, l); | 526 | xsignal1 (Qoverflow_error, l); |
| 529 | return mpz_get_si (XBIGNUM (l)->value); | 527 | return i; |
| 530 | } | 528 | } |
| 531 | return XFIXNUM (l); | 529 | return XFIXNUM (l); |
| 532 | } | 530 | } |