aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlrich Mueller2012-08-14 14:58:01 +0800
committerChong Yidong2012-08-14 14:58:01 +0800
commit7f654971e061afdaa4df62486cde4452abe698de (patch)
tree32318d842f9890de454d1f82fe8f5003b93cf9f3
parent45e7ed71652ff194ea9389d40c49c7109af3d2d5 (diff)
downloademacs-7f654971e061afdaa4df62486cde4452abe698de.tar.gz
emacs-7f654971e061afdaa4df62486cde4452abe698de.zip
* systime.h (EMACS_TIME_CMP): Don't cast time_t values to long.
Fixes: debbugs:11712
-rw-r--r--src/ChangeLog5
-rw-r--r--src/systime.h11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index fbe4f06da58..28e053be63f 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-08-14 Ulrich Mueller <ulm@gentoo.org>
2
3 * systime.h (EMACS_TIME_CMP): Don't cast time_t values to long
4 (Bug#11712).
5
12012-08-13 Eli Zaretskii <eliz@gnu.org> 62012-08-13 Eli Zaretskii <eliz@gnu.org>
2 7
3 * w32menu.c: Include w32heap.h. 8 * w32menu.c: Include w32heap.h.
diff --git a/src/systime.h b/src/systime.h
index 9e7a1173a20..e6ebe4689df 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -147,15 +147,12 @@ extern int lisp_time_argument (Lisp_Object, time_t *, int *);
147#endif 147#endif
148 148
149/* Compare times T1 and T2. Value is 0 if T1 and T2 are the same. 149/* Compare times T1 and T2. Value is 0 if T1 and T2 are the same.
150 Value is < 0 if T1 is less than T2. Value is > 0 otherwise. (Cast 150 Value is < 0 if T1 is less than T2. Value is > 0 otherwise. */
151 to long is for those platforms where time_t is an unsigned
152 type, and where otherwise T1 will always be grater than T2.) */
153 151
154#define EMACS_TIME_CMP(T1, T2) \ 152#define EMACS_TIME_CMP(T1, T2) \
155 ((long)EMACS_SECS (T1) - (long)EMACS_SECS (T2) \ 153 (EMACS_SECS (T1) == EMACS_SECS (T2) \
156 + (EMACS_SECS (T1) == EMACS_SECS (T2) \ 154 ? EMACS_USECS (T1) - EMACS_USECS (T2) \
157 ? EMACS_USECS (T1) - EMACS_USECS (T2) \ 155 : (EMACS_SECS (T1) < EMACS_SECS (T2) ? -1 : 1))
158 : 0))
159 156
160/* Compare times T1 and T2 for equality, inequality etc. */ 157/* Compare times T1 and T2 for equality, inequality etc. */
161 158