aboutsummaryrefslogtreecommitdiffstats
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorPaul Eggert2015-02-08 16:21:11 -0800
committerPaul Eggert2015-02-08 16:21:44 -0800
commitfd6f7d1449c8496ab5c019d2aad7ca5e2980713a (patch)
tree83934f904dda8a258d8b8175d0f6120f510b3790 /src/keyboard.c
parentdb3fc07caf71b6d7a34f80333ba54ed6d67ee144 (diff)
downloademacs-fd6f7d1449c8496ab5c019d2aad7ca5e2980713a.tar.gz
emacs-fd6f7d1449c8496ab5c019d2aad7ca5e2980713a.zip
Better distinguish infinite from invalid times
* editfns.c (check_time_validity): New function. (decode_time_components): Return int, not bool. Return -1 (not 0) if the time is out of range. All callers changed. (lisp_time_struct, lisp_seconds_argument): Distinguish better between time overflow and invalid time values.
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 1176d701f2a..ee621923c67 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -4369,19 +4369,18 @@ Lisp_Object pending_funcalls;
4369static bool 4369static bool
4370decode_timer (Lisp_Object timer, struct timespec *result) 4370decode_timer (Lisp_Object timer, struct timespec *result)
4371{ 4371{
4372 Lisp_Object *vector; 4372 Lisp_Object *vec;
4373 4373
4374 if (! (VECTORP (timer) && ASIZE (timer) == 9)) 4374 if (! (VECTORP (timer) && ASIZE (timer) == 9))
4375 return 0; 4375 return 0;
4376 vector = XVECTOR (timer)->contents; 4376 vec = XVECTOR (timer)->contents;
4377 if (! NILP (vector[0])) 4377 if (! NILP (vec[0]))
4378 return 0; 4378 return 0;
4379 if (! INTEGERP (vector[2])) 4379 if (! INTEGERP (vec[2]))
4380 return false; 4380 return false;
4381 4381
4382 struct lisp_time t; 4382 struct lisp_time t;
4383 if (! decode_time_components (vector[1], vector[2], vector[3], vector[8], 4383 if (decode_time_components (vec[1], vec[2], vec[3], vec[8], &t, 0) <= 0)
4384 &t, 0))
4385 return false; 4384 return false;
4386 *result = lisp_to_timespec (t); 4385 *result = lisp_to_timespec (t);
4387 return timespec_valid_p (*result); 4386 return timespec_valid_p (*result);