summaryrefslogtreecommitdiff
path: root/src/emacs-module.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2018-08-30 18:10:18 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2018-08-30 18:10:56 -0700
commit7c0675af3c9aa7971c37aa9e7afdceae6bfea767 (patch)
tree8d1cd73a60f9437f4768876a104c272ab8a09520 /src/emacs-module.c
parent15006cf1dd9ec873c4b1cad1ba1bacf0a5b6229d (diff)
downloademacs-7c0675af3c9aa7971c37aa9e7afdceae6bfea767.tar.gz
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/emacs-module.c')
-rw-r--r--src/emacs-module.c8
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/>. */
#include <stdio.h>
#include "lisp.h"
-#include "bignum.h"
#include "dynlib.h"
#include "coding.h"
#include "keyboard.h"
@@ -522,11 +521,10 @@ module_extract_integer (emacs_env *env, emacs_value n)
CHECK_INTEGER (l);
if (BIGNUMP (l))
{
- /* FIXME: This can incorrectly signal overflow on platforms
- where long is narrower than intmax_t. */
- if (!mpz_fits_slong_p (XBIGNUM (l)->value))
+ intmax_t i = bignum_to_intmax (l);
+ if (i == 0)
xsignal1 (Qoverflow_error, l);
- return mpz_get_si (XBIGNUM (l)->value);
+ return i;
}
return XFIXNUM (l);
}