emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108105: * systime.h (EMACS_TIME_C


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108105: * systime.h (EMACS_TIME_CMP): Don't cast time_t values to long.
Date: Tue, 14 Aug 2012 14:58:01 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108105
fixes bug: http://debbugs.gnu.org/11712
author: Ulrich Mueller <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: emacs-24
timestamp: Tue 2012-08-14 14:58:01 +0800
message:
  * systime.h (EMACS_TIME_CMP): Don't cast time_t values to long.
modified:
  src/ChangeLog
  src/systime.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-13 18:34:37 +0000
+++ b/src/ChangeLog     2012-08-14 06:58:01 +0000
@@ -1,3 +1,8 @@
+2012-08-14  Ulrich Mueller  <address@hidden>
+
+       * systime.h (EMACS_TIME_CMP): Don't cast time_t values to long
+       (Bug#11712).
+
 2012-08-13  Eli Zaretskii  <address@hidden>
 
        * w32menu.c: Include w32heap.h.

=== modified file 'src/systime.h'
--- a/src/systime.h     2012-01-19 07:21:25 +0000
+++ b/src/systime.h     2012-08-14 06:58:01 +0000
@@ -147,15 +147,12 @@
 #endif
 
 /* Compare times T1 and T2.  Value is 0 if T1 and T2 are the same.
-   Value is < 0 if T1 is less than T2.  Value is > 0 otherwise.  (Cast
-   to long is for those platforms where time_t is an unsigned
-   type, and where otherwise T1 will always be grater than T2.)  */
+   Value is < 0 if T1 is less than T2.  Value is > 0 otherwise.  */
 
 #define EMACS_TIME_CMP(T1, T2)                         \
-  ((long)EMACS_SECS (T1) - (long)EMACS_SECS (T2)       \
-   + (EMACS_SECS (T1) == EMACS_SECS (T2)               \
-      ? EMACS_USECS (T1) - EMACS_USECS (T2)            \
-      : 0))
+  (EMACS_SECS (T1) == EMACS_SECS (T2)                  \
+   ? EMACS_USECS (T1) - EMACS_USECS (T2)               \
+   : (EMACS_SECS (T1) < EMACS_SECS (T2) ? -1 : 1))
 
 /* Compare times T1 and T2 for equality, inequality etc.  */
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]