From 3300e6fd43c4059de955cddc37ec4212dab2b085 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 7 Jul 2011 10:55:38 -0700 Subject: [PATCH] * keyboard.h (num_input_events): Now uintmax_t. This is (very slightly) less likely to mess up due to wraparound. All uses changed. --- src/ChangeLog | 4 ++++ src/callint.c | 2 +- src/keyboard.c | 4 ++-- src/keyboard.h | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 6d8ee7d5306..8d8e8789811 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-07-07 Paul Eggert + * keyboard.h (num_input_events): Now uintmax_t. + This is (very slightly) less likely to mess up due to wraparound. + All uses changed. + * buffer.c: Integer signedness fixes. (alloc_buffer_text, enlarge_buffer_text): Use ptrdiff_t rather than size_t when either will do, as we prefer diff --git a/src/callint.c b/src/callint.c index 1371b403e4b..d17f850eb53 100644 --- a/src/callint.c +++ b/src/callint.c @@ -339,7 +339,7 @@ invoke it. If KEYS is omitted or nil, the return value of { Lisp_Object input; Lisp_Object funval = Findirect_function (function, Qt); - size_t events = num_input_events; + uintmax_t events = num_input_events; input = specs; /* Compute the arg values using the user's expression. */ GCPRO2 (input, filter_specs); diff --git a/src/keyboard.c b/src/keyboard.c index 16300e6154c..926ebc30b71 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -210,8 +210,8 @@ Lisp_Object unread_switch_frame; /* Last size recorded for a current buffer which is not a minibuffer. */ static EMACS_INT last_non_minibuf_size; -/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */ -size_t num_input_events; +/* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */ +uintmax_t num_input_events; /* Value of num_nonmacro_input_events as of last auto save. */ diff --git a/src/keyboard.h b/src/keyboard.h index 91008a3ea24..69c804c873d 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -191,8 +191,8 @@ extern KBOARD *current_kboard; /* A list of all kboard objects, linked through next_kboard. */ extern KBOARD *all_kboards; -/* Total number of times read_char has returned, modulo SIZE_MAX + 1. */ -extern size_t num_input_events; +/* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */ +extern uintmax_t num_input_events; /* Nonzero means polling for input is temporarily suppressed. */ extern int poll_suppress_count; -- 2.39.2