From 8e09f23fbf217926f2d1d1e2c71e393d9e74c891 Mon Sep 17 00:00:00 2001 From: "Kim F. Storm" Date: Tue, 11 Jul 2006 22:55:29 +0000 Subject: [PATCH] (sit_for): Signal error if TIMEOUT is not a number in case arg comes directly from a Lisp variable. --- src/ChangeLog | 1 + src/dispnew.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 182dea1afda..02b51115719 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,7 @@ * dispnew.c (sit_for): Reduce number of args from 5 to 3. Now just one TIMEOUT arg that can be a Lisp float or Lisp int. Combine args DISPLAY and INITIAL_DISPLAY into one arg DO_DISPLAY. + Signal error if TIMEOUT is not a number. Undo 2006-06-14 change for non-preemptive display if TIMEOUT < 0. The rework of sit_for args also fixes several incorrect Qt args which should have been 1. diff --git a/src/dispnew.c b/src/dispnew.c index 3519e2d64fe..018717e591f 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6519,17 +6519,21 @@ sit_for (timeout, reading, do_display) if (do_display >= 2) redisplay_preserve_echo_area (2); - if (FLOATP (timeout)) + if (INTEGERP (timeout)) { - double seconds = XFLOAT_DATA (timeout); + sec = XFASTINT (timeout); + usec = 0; + } + else if (FLOATP (timeout)) + { + double seconds; + + seconds = XFLOAT_DATA (timeout); sec = (int) seconds; usec = (int) ((seconds - sec) * 1000000); } else - { - sec = XFASTINT (timeout); - usec = 0; - } + wrong_type_argument (Qnumberp, timeout); if (sec == 0 && usec == 0) return Qt; -- 2.39.2