diff options
| author | Paul Eggert | 2012-07-10 16:24:36 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-10 16:24:36 -0700 |
| commit | e9a9ae0350689d352c2bdfa3af0eb722f587b966 (patch) | |
| tree | 10ed0298079b06838a525f0a4df780d7600e13fe /src/image.c | |
| parent | ffacb12679a1e001981c2e0f690b327eda652d04 (diff) | |
| download | emacs-e9a9ae0350689d352c2bdfa3af0eb722f587b966.tar.gz emacs-e9a9ae0350689d352c2bdfa3af0eb722f587b966.zip | |
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/image.c')
| -rw-r--r-- | src/image.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/image.c b/src/image.c index b4ad329bacb..88d2f36cda9 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1061,7 +1061,7 @@ void | |||
| 1061 | prepare_image_for_display (struct frame *f, struct image *img) | 1061 | prepare_image_for_display (struct frame *f, struct image *img) |
| 1062 | { | 1062 | { |
| 1063 | /* We're about to display IMG, so set its timestamp to `now'. */ | 1063 | /* We're about to display IMG, so set its timestamp to `now'. */ |
| 1064 | EMACS_GET_TIME (img->timestamp); | 1064 | img->timestamp = current_emacs_time (); |
| 1065 | 1065 | ||
| 1066 | /* If IMG doesn't have a pixmap yet, load it now, using the image | 1066 | /* If IMG doesn't have a pixmap yet, load it now, using the image |
| 1067 | type dependent loader function. */ | 1067 | type dependent loader function. */ |
| @@ -1520,8 +1520,8 @@ clear_image_cache (struct frame *f, Lisp_Object filter) | |||
| 1520 | delay = 1600 * delay / nimages / nimages; | 1520 | delay = 1600 * delay / nimages / nimages; |
| 1521 | delay = max (delay, 1); | 1521 | delay = max (delay, 1); |
| 1522 | 1522 | ||
| 1523 | EMACS_GET_TIME (t); | 1523 | t = current_emacs_time (); |
| 1524 | EMACS_SUB_TIME (old, t, EMACS_TIME_FROM_DOUBLE (delay)); | 1524 | old = sub_emacs_time (t, EMACS_TIME_FROM_DOUBLE (delay)); |
| 1525 | 1525 | ||
| 1526 | for (i = 0; i < c->used; ++i) | 1526 | for (i = 0; i < c->used; ++i) |
| 1527 | { | 1527 | { |
| @@ -1792,7 +1792,7 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1792 | } | 1792 | } |
| 1793 | 1793 | ||
| 1794 | /* We're using IMG, so set its timestamp to `now'. */ | 1794 | /* We're using IMG, so set its timestamp to `now'. */ |
| 1795 | EMACS_GET_TIME (img->timestamp); | 1795 | img->timestamp = current_emacs_time (); |
| 1796 | 1796 | ||
| 1797 | /* Value is the image id. */ | 1797 | /* Value is the image id. */ |
| 1798 | return img->id; | 1798 | return img->id; |