Module Name:    src
Committed By:   christos
Date:           Tue Aug 16 07:51:46 UTC 2011

Modified Files:
        src/lib/libc/time: zdump.c

Log Message:
do the overflow check in a way that gcc-4.5 likes.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/time/zdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.19 src/lib/libc/time/zdump.c:1.20
--- src/lib/libc/time/zdump.c:1.19	Sat Jan 15 07:31:57 2011
+++ src/lib/libc/time/zdump.c	Tue Aug 16 03:51:46 2011
@@ -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.

Reply via email to