diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-04-05 01:17:32 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-04-05 01:24:36 -0700 |
commit | bec5cfee7660f6e283efbd30a693a6f8e9ea46b8 (patch) | |
tree | b6b872dfb83579336e848a62f720b629426c0ac0 /src/fileio.c | |
parent | 9b8dacdb264412b919782920da916e306102262a (diff) | |
download | emacs-bec5cfee7660f6e283efbd30a693a6f8e9ea46b8.tar.gz |
Improve integer range checking
* src/bignum.c (check_integer_range, check_uinteger_max)
(check_int_nonnegative): New functions.
* src/frame.c (check_frame_pixels): New function.
(Fset_frame_height, Fset_frame_width, Fset_frame_size): Use it.
* src/lisp.h (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER):
Remove these macros. Unless otherwise specified, all callers
replaced by calls to check_integer_range, check_uinteger_range,
check_int_nonnegative.
* src/frame.c (gui_set_right_divider_width)
(gui_set_bottom_divider_width):
* src/nsfns.m (ns_set_internal_border_width):
* src/xfns.c (x_set_internal_border_width):
Using check_int_nonnegative means these functions no longer
incorrectly reject negative bignums; they treat them as 0,
just like negative fixnums.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fileio.c b/src/fileio.c index 978a373d39b..2f1d2f82433 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5682,8 +5682,8 @@ in `current-time' or an integer flag as returned by `visited-file-modtime'. */) struct timespec mtime; if (FIXNUMP (time_flag)) { - CHECK_RANGED_INTEGER (time_flag, -1, 0); - mtime = make_timespec (0, UNKNOWN_MODTIME_NSECS - XFIXNUM (time_flag)); + int flag = check_integer_range (time_flag, -1, 0); + mtime = make_timespec (0, UNKNOWN_MODTIME_NSECS - flag); } else mtime = lisp_time_argument (time_flag); |