aboutsummaryrefslogtreecommitdiffstats
path: root/src/character.c
diff options
context:
space:
mode:
authorPaul Eggert2020-04-05 01:17:32 -0700
committerPaul Eggert2020-04-05 01:24:36 -0700
commitbec5cfee7660f6e283efbd30a693a6f8e9ea46b8 (patch)
treeb6b872dfb83579336e848a62f720b629426c0ac0 /src/character.c
parent9b8dacdb264412b919782920da916e306102262a (diff)
downloademacs-bec5cfee7660f6e283efbd30a693a6f8e9ea46b8.tar.gz
emacs-bec5cfee7660f6e283efbd30a693a6f8e9ea46b8.zip
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/character.c')
-rw-r--r--src/character.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/character.c b/src/character.c
index a566cacb023..c938e9fe412 100644
--- a/src/character.c
+++ b/src/character.c
@@ -876,10 +876,7 @@ usage: (unibyte-string &rest BYTES) */)
876 Lisp_Object str = make_uninit_string (n); 876 Lisp_Object str = make_uninit_string (n);
877 unsigned char *p = SDATA (str); 877 unsigned char *p = SDATA (str);
878 for (ptrdiff_t i = 0; i < n; i++) 878 for (ptrdiff_t i = 0; i < n; i++)
879 { 879 *p++ = check_integer_range (args[i], 0, 255);
880 CHECK_RANGED_INTEGER (args[i], 0, 255);
881 *p++ = XFIXNUM (args[i]);
882 }
883 return str; 880 return str;
884} 881}
885 882