Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/time do the overflow check in a way that gcc-4.5 li...
details: https://anonhg.NetBSD.org/src/rev/ff6d194a231c
branches: trunk
changeset: 768394:ff6d194a231c
user: christos <christos%NetBSD.org@localhost>
date: Tue Aug 16 07:51:46 2011 +0000
description:
do the overflow check in a way that gcc-4.5 likes.
diffstat:
lib/libc/time/zdump.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r bfc9d613c41b -r ff6d194a231c lib/libc/time/zdump.c
--- a/lib/libc/time/zdump.c Tue Aug 16 07:05:15 2011 +0000
+++ b/lib/libc/time/zdump.c Tue Aug 16 07:51:46 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: zdump.c,v 1.19 2011/01/15 12:31:57 martin Exp $ */
+/* $NetBSD: zdump.c,v 1.20 2011/08/16 07:51:46 christos Exp $ */
/*
** This file is in the public domain, so clarified as of
** 2009-05-17 by Arthur David Olson.
@@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
#ifndef NOID
-__RCSID("$NetBSD: zdump.c,v 1.19 2011/01/15 12:31:57 martin Exp $");
+__RCSID("$NetBSD: zdump.c,v 1.20 2011/08/16 07:51:46 christos Exp $");
#endif /* !defined NOID */
#endif /* !defined lint */
@@ -410,6 +410,15 @@
return EXIT_FAILURE;
}
+static time_t
+ovfl_check(time_t t)
+{
+ if (t < 0 && t - 1 >= 0)
+ return t;
+ else
+ return t - 1;
+}
+
static void
setabsolutes(void)
{
@@ -443,9 +452,7 @@
absolute_max_time = t;
t = -t;
- absolute_min_time = t - 1;
- if (t < absolute_min_time)
- absolute_min_time = t;
+ absolute_min_time = ovfl_check(t);
} else {
/*
** time_t is unsigned.
Home |
Main Index |
Thread Index |
Old Index