diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-10 16:24:36 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-10 16:24:36 -0700 |
commit | e9a9ae0350689d352c2bdfa3af0eb722f587b966 (patch) | |
tree | 10ed0298079b06838a525f0a4df780d7600e13fe /src/dispnew.c | |
parent | ffacb12679a1e001981c2e0f690b327eda652d04 (diff) | |
download | emacs-e9a9ae0350689d352c2bdfa3af0eb722f587b966.tar.gz |
EMACS_TIME simplification (Bug#11875).
This replaces macros (which typically do not work in GDB)
with functions, typedefs and enums, making the code easier to debug.
The functional style also makes code easier to read and maintain.
* lib-src/profile.c (TV2): Remove no-longer-needed static var.
* src/systime.h: Include <sys/time.h> on all hosts, not just if
WINDOWSNT, since 'struct timeval' is needed in general.
(EMACS_TIME): Now a typedef, not a macro.
(EMACS_TIME_RESOLUTION, LOG10_EMACS_TIME_RESOLUTION): Now constants,
not macros.
(EMACS_SECS, EMACS_NSECS, EMACS_TIME_SIGN, EMACS_TIME_VALID_P)
(EMACS_TIME_FROM_DOUBLE, EMACS_TIME_TO_DOUBLE, EMACS_TIME_EQ)
(EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE, EMACS_TIME_LT)
(EMACS_TIME_LE): Now functions, not macros.
(EMACS_SET_SECS, EMACS_SET_NSECS, EMACS_SET_SECS_NSECS)
(EMACS_SET_USECS, EMACS_SET_SECS_USECS): Remove these macros,
which are not functions. All uses rewritten to use:
(make_emacs_time): New function.
(EMACS_SECS_ADDR, EMACS_SET_INVALID_TIME, EMACS_GET_TIME)
(EMACS_ADD_TIME, EMACS_SUB_TIME): Remove these macros, which are
not functions. All uses rewritten to use the following, respectively:
(emacs_secs_addr, invalid_emacs_time, get_emacs_time)
(add_emacs_time, sub_emacs_time): New functions.
* src/atimer.c: Don't include <sys/time.h>, as "systime.h" does this.
* src/fileio.c (Fcopy_file):
* src/xterm.c (XTflash): Get the current time closer to when it's used.
* src/makefile.w32-in ($(BLD)/atimer.$(O)): Update dependencies.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r-- | src/dispnew.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 0d34147e035..c149baec507 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3191,7 +3191,6 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) force_p = 1; else if (!force_p && NUMBERP (Vredisplay_preemption_period)) { - EMACS_TIME tm; double p = XFLOATINT (Vredisplay_preemption_period); if (detect_input_pending_ignore_squeezables ()) @@ -3200,9 +3199,9 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) goto do_pause; } - EMACS_GET_TIME (tm); preemption_period = EMACS_TIME_FROM_DOUBLE (p); - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (current_emacs_time (), + preemption_period); } if (FRAME_WINDOW_P (f)) @@ -3344,12 +3343,10 @@ update_single_window (struct window *w, int force_p) force_p = 1; else if (!force_p && NUMBERP (Vredisplay_preemption_period)) { - EMACS_TIME tm; double p = XFLOATINT (Vredisplay_preemption_period); - - EMACS_GET_TIME (tm); preemption_period = EMACS_TIME_FROM_DOUBLE (p); - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (current_emacs_time (), + preemption_period); } /* Update W. */ @@ -3596,11 +3593,11 @@ update_window (struct window *w, int force_p) #if PERIODIC_PREEMPTION_CHECKING if (!force_p) { - EMACS_TIME tm; - EMACS_GET_TIME (tm); + EMACS_TIME tm = current_emacs_time (); if (EMACS_TIME_LT (preemption_next_check, tm)) { - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (tm, + preemption_period); if (detect_input_pending_ignore_squeezables ()) break; } @@ -4701,11 +4698,10 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) #if PERIODIC_PREEMPTION_CHECKING if (!force_p) { - EMACS_TIME tm; - EMACS_GET_TIME (tm); + EMACS_TIME tm = current_emacs_time (); if (EMACS_TIME_LT (preemption_next_check, tm)) { - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (tm, preemption_period); if (detect_input_pending_ignore_squeezables ()) break; } |