aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorPaul Eggert2013-08-27 11:47:55 -0700
committerPaul Eggert2013-08-27 11:47:55 -0700
commit43aac990c339c0fc3304aa476ebc8ea8467f107e (patch)
tree24f6477d7ec79c7f3529e08c421f309b1180c436 /src/image.c
parent278208b8e6917af1e7e2623a3869614fa70059ed (diff)
downloademacs-43aac990c339c0fc3304aa476ebc8ea8467f107e.tar.gz
emacs-43aac990c339c0fc3304aa476ebc8ea8467f107e.zip
Simplify EMACS_TIME-related code.
This portability layer is no longer needed, since Emacs has been using struct timespec as a portability layer for some time. Merge from gnulib, incorporating: 2013-08-27 timespec: new convenience constants and function * src/atimer.h, src/buffer.h, src/dispextern.h, src/xgselect.h: Include <time.h> rather than "systime.h"; that's all that's needed now. * src/dispnew.c: Include <timespec.h> rather than "systime.h"; that's all that's needed now. * src/systime.h (EMACS_TIME): Remove. All uses changed to struct timespec. (EMACS_TIME_RESOLUTION): Remove. All uses changed to TIMESPEC_RESOLUTION. (LOG10_EMACS_TIME_RESOLUTION): Remove. All uses changed to LOG10_TIMESPEC_RESOLUTION. (EMACS_SECS, emacs_secs_addr): Remove. All uses changed to tv_sec. (EMACS_NSECS): Remove. All uses changed to tv_nsec. (make_emacs_time): Remove. All used changed to make_timespec. (invalid_timespec): Rename from invalid_emacs_time. All uses changed. (current_timespec): Rename from current_emacs_time. All uses changed. (add_emacs_time): Remove. All uses changed to timespec_add. (sub_emacs_time): Remove. All uses change dot timespec_sub. (EMACS_TIME_SIGN): Remove. All uses changed to timespec_sign. (timespec_valid_p): Rename from EMACS_TIME_VALID_P. All uses changed. (EMACS_TIME_FROM_DOUBLE): Remove. All uses changed to dtotimespec. (EMACS_TIME_TO_DOUBLE): Remove. All uses changed to timespectod. (current_timespec): Rename from current_emacs_time. All uses changed. (EMACS_TIME_EQ, EMACS_TIME_LT, EMACS_TIME_LE): Remove. All uses changed to timespec_cmp. * src/xgselect.c: Include <timespec.h>, since our .h files don't.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/image.c b/src/image.c
index 8d9c33de12c..bcc0fcd78a3 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1041,7 +1041,7 @@ void
1041prepare_image_for_display (struct frame *f, struct image *img) 1041prepare_image_for_display (struct frame *f, struct image *img)
1042{ 1042{
1043 /* We're about to display IMG, so set its timestamp to `now'. */ 1043 /* We're about to display IMG, so set its timestamp to `now'. */
1044 img->timestamp = current_emacs_time (); 1044 img->timestamp = current_timespec ();
1045 1045
1046 /* If IMG doesn't have a pixmap yet, load it now, using the image 1046 /* If IMG doesn't have a pixmap yet, load it now, using the image
1047 type dependent loader function. */ 1047 type dependent loader function. */
@@ -1480,7 +1480,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
1480 else if (INTEGERP (Vimage_cache_eviction_delay)) 1480 else if (INTEGERP (Vimage_cache_eviction_delay))
1481 { 1481 {
1482 /* Free cache based on timestamp. */ 1482 /* Free cache based on timestamp. */
1483 EMACS_TIME old, t; 1483 struct timespec old, t;
1484 double delay; 1484 double delay;
1485 ptrdiff_t nimages = 0; 1485 ptrdiff_t nimages = 0;
1486 1486
@@ -1495,13 +1495,13 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
1495 delay = 1600 * delay / nimages / nimages; 1495 delay = 1600 * delay / nimages / nimages;
1496 delay = max (delay, 1); 1496 delay = max (delay, 1);
1497 1497
1498 t = current_emacs_time (); 1498 t = current_timespec ();
1499 old = sub_emacs_time (t, EMACS_TIME_FROM_DOUBLE (delay)); 1499 old = timespec_sub (t, dtotimespec (delay));
1500 1500
1501 for (i = 0; i < c->used; ++i) 1501 for (i = 0; i < c->used; ++i)
1502 { 1502 {
1503 struct image *img = c->images[i]; 1503 struct image *img = c->images[i];
1504 if (img && EMACS_TIME_LT (img->timestamp, old)) 1504 if (img && timespec_cmp (img->timestamp, old) < 0)
1505 { 1505 {
1506 free_image (f, img); 1506 free_image (f, img);
1507 ++nfreed; 1507 ++nfreed;
@@ -1764,7 +1764,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
1764 } 1764 }
1765 1765
1766 /* We're using IMG, so set its timestamp to `now'. */ 1766 /* We're using IMG, so set its timestamp to `now'. */
1767 img->timestamp = current_emacs_time (); 1767 img->timestamp = current_timespec ();
1768 1768
1769 /* Value is the image id. */ 1769 /* Value is the image id. */
1770 return img->id; 1770 return img->id;
@@ -7884,7 +7884,7 @@ struct animation_cache
7884{ 7884{
7885 MagickWand *wand; 7885 MagickWand *wand;
7886 int index; 7886 int index;
7887 EMACS_TIME update_time; 7887 struct timespec update_time;
7888 struct animation_cache *next; 7888 struct animation_cache *next;
7889 char signature[FLEXIBLE_ARRAY_MEMBER]; 7889 char signature[FLEXIBLE_ARRAY_MEMBER];
7890}; 7890};
@@ -7909,13 +7909,13 @@ static void
7909imagemagick_prune_animation_cache (void) 7909imagemagick_prune_animation_cache (void)
7910{ 7910{
7911 struct animation_cache **pcache = &animation_cache; 7911 struct animation_cache **pcache = &animation_cache;
7912 EMACS_TIME old = sub_emacs_time (current_emacs_time (), 7912 struct timespec old = timespec_sub (current_timespec (),
7913 make_emacs_time (60, 0)); 7913 make_timespec (60, 0));
7914 7914
7915 while (*pcache) 7915 while (*pcache)
7916 { 7916 {
7917 struct animation_cache *cache = *pcache; 7917 struct animation_cache *cache = *pcache;
7918 if (EMACS_TIME_LE (old, cache->update_time)) 7918 if (timespec_cmp (old, cache->update_time) <= 0)
7919 pcache = &cache->next; 7919 pcache = &cache->next;
7920 else 7920 else
7921 { 7921 {
@@ -7950,7 +7950,7 @@ imagemagick_get_animation_cache (MagickWand *wand)
7950 } 7950 }
7951 7951
7952 DestroyString (signature); 7952 DestroyString (signature);
7953 cache->update_time = current_emacs_time (); 7953 cache->update_time = current_timespec ();
7954 return cache; 7954 return cache;
7955} 7955}
7956 7956