summaryrefslogtreecommitdiff
path: root/src/emacs-module.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-11-19 14:03:29 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-11-19 14:04:00 -0800
commit68d58e69738db41061812b10f2f3f50b6a1b9aa0 (patch)
tree8045f9ded98f40daf1901862d729d1336adf2f06 /src/emacs-module.c
parentf2c002592196297a3517b3ed1f05c8ac7b096044 (diff)
downloademacs-68d58e69738db41061812b10f2f3f50b6a1b9aa0.tar.gz
Prefer intmax_t to int64_t in module code
* modules/mod-test/mod-test.c (sum, Fmod_test_sum): * src/emacs-module.c (module_extract_integer) (module_make_integer): * src/emacs-module.h (struct emacs_env_25): Prefer intmax_t to int64_t. This doesn’t change the generated code on any of the machines Emacs currently ports to, but it’s at least in theory more future-proof as C99 doesn’t guarantee that int64_t exists.
Diffstat (limited to 'src/emacs-module.c')
-rw-r--r--src/emacs-module.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 4fa01bf5bed..b39ac7df057 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -451,11 +451,9 @@ module_eq (emacs_env *env, emacs_value a, emacs_value b)
return EQ (value_to_lisp (a), value_to_lisp (b));
}
-static int64_t
+static intmax_t
module_extract_integer (emacs_env *env, emacs_value n)
{
- verify (INT64_MIN <= MOST_NEGATIVE_FIXNUM);
- verify (INT64_MAX >= MOST_POSITIVE_FIXNUM);
check_main_thread ();
eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return);
const Lisp_Object l = value_to_lisp (n);
@@ -468,16 +466,11 @@ module_extract_integer (emacs_env *env, emacs_value n)
}
static emacs_value
-module_make_integer (emacs_env *env, int64_t n)
+module_make_integer (emacs_env *env, intmax_t n)
{
check_main_thread ();
eassert (module_non_local_exit_check (env) == emacs_funcall_exit_return);
- if (n < MOST_NEGATIVE_FIXNUM)
- {
- module_non_local_exit_signal_1 (env, Qunderflow_error, Qnil);
- return NULL;
- }
- if (n > MOST_POSITIVE_FIXNUM)
+ if (! (MOST_NEGATIVE_FIXNUM <= n && n <= MOST_POSITIVE_FIXNUM))
{
module_non_local_exit_signal_1 (env, Qoverflow_error, Qnil);
return NULL;