aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorPaul Eggert2019-05-22 13:25:47 -0700
committerPaul Eggert2019-05-22 13:29:13 -0700
commitdfed333b312d06b3416ebfadff544eae38313391 (patch)
treec4c013baf966e177418675b5ed08c9a08832396d /src/data.c
parent5c21832ae866077874fb662e49c695a7850ec22c (diff)
downloademacs-dfed333b312d06b3416ebfadff544eae38313391.tar.gz
emacs-dfed333b312d06b3416ebfadff544eae38313391.zip
Remove fixnum restriction on some display vars
This is a minor patch to remove some fixnum restrictions. Many more such patches are needed, but one thing at a time. * doc/emacs/custom.texi (Examining): Update fill-column example. * src/buffer.c (fill-column, left-margin, tab-width) (buffer-saved-size, left-margin-width, right-margin-width) (left-fringe-width, right-fringe-width, scroll-bar-width) (scroll-bar-height, buffer-display-count): Allow any integer; do not restrict to fixnums. * src/character.h (SANE_TAB_WIDTH): Do not assume tab_width is a nonnegative fixnum. (sanitize_tab_width): Take a Lisp_Object integer, not an EMACS_INT. Only use changed. * src/data.c (store_symval_forwarding): Remove unnecessary SYMBOLP since the predicate (e.g., Qintegerp) is always a symbol (leave the test in as an eassert). Avoid assignments inside if-conditions. * src/fileio.c (Fdo_auto_save): Do not assume buffer-saved-size is a fixnum. Avoid undefined behavior on EMACS_INT overflow by multiplying a fixnum by at most 4, not by at most 13. * src/window.c (set_window_buffer): When buffer-display-count is too large for a fixnum, make it a bignum. * src/xdisp.c (FILL_COLUMN_INDICATOR_NEEDED): Remove macro, ... (fill_column_indicator_column): ... replacing with this new function. All uses changed. The function is a bit pickier, to prevent problems with non-character fixnums and columns out of range for int, and to remove the assumption that integers are in fixnum range. (append_space_for_newline, extend_face_to_end_of_line): Avoid undefined behavior with signed integer overflow. Simplify.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/data.c b/src/data.c
index 476d28eadbc..c1699aeae73 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1122,20 +1122,21 @@ store_symval_forwarding (lispfwd valcontents, Lisp_Object newval,
1122 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1122 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1123 Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate; 1123 Lisp_Object predicate = XBUFFER_OBJFWD (valcontents)->predicate;
1124 1124
1125 if (!NILP (newval)) 1125 if (!NILP (newval) && !NILP (predicate))
1126 { 1126 {
1127 if (SYMBOLP (predicate)) 1127 eassert (SYMBOLP (predicate));
1128 Lisp_Object choiceprop = Fget (predicate, Qchoice);
1129 if (!NILP (choiceprop))
1128 { 1130 {
1129 Lisp_Object prop; 1131 if (NILP (Fmemq (newval, choiceprop)))
1130 1132 wrong_choice (choiceprop, newval);
1131 if ((prop = Fget (predicate, Qchoice), !NILP (prop))) 1133 }
1132 { 1134 else
1133 if (NILP (Fmemq (newval, prop))) 1135 {
1134 wrong_choice (prop, newval); 1136 Lisp_Object rangeprop = Fget (predicate, Qrange);
1135 } 1137 if (CONSP (rangeprop))
1136 else if ((prop = Fget (predicate, Qrange), !NILP (prop)))
1137 { 1138 {
1138 Lisp_Object min = XCAR (prop), max = XCDR (prop); 1139 Lisp_Object min = XCAR (rangeprop), max = XCDR (rangeprop);
1139 if (! NUMBERP (newval) 1140 if (! NUMBERP (newval)
1140 || NILP (CALLN (Fleq, min, newval, max))) 1141 || NILP (CALLN (Fleq, min, newval, max)))
1141 wrong_range (min, max, newval); 1142 wrong_range (min, max, newval);