Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/time use a define, and cast.



details:   https://anonhg.NetBSD.org/src/rev/6fbfd5a00674
branches:  trunk
changeset: 347871:6fbfd5a00674
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Sep 20 15:03:07 2016 +0000

description:
use a define, and cast.

diffstat:

 lib/libc/time/zic.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (31 lines):

diff -r 501b00461958 -r 6fbfd5a00674 lib/libc/time/zic.c
--- a/lib/libc/time/zic.c       Tue Sep 20 14:30:13 2016 +0000
+++ b/lib/libc/time/zic.c       Tue Sep 20 15:03:07 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos Exp $        */
+/*     $NetBSD: zic.c,v 1.62 2016/09/20 15:03:07 christos Exp $        */
 /*
 ** This file is in the public domain, so clarified as of
 ** 2006-07-17 by Arthur David Olson.
@@ -10,7 +10,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: zic.c,v 1.61 2016/09/20 13:09:08 christos Exp $");
+__RCSID("$NetBSD: zic.c,v 1.62 2016/09/20 15:03:07 christos Exp $");
 #endif /* !defined lint */
 
 #include "private.h"
@@ -437,9 +437,9 @@
        if (nitems < *nitems_alloc)
                return ptr;
        else {
-               static const int imax = INT_MAX < SIZE_MAX ? INT_MAX : SIZE_MAX;
-               int nitems_max = imax - WORK_AROUND_QTBUG_53071;
-               int amax = nitems_max < imax ? nitems_max : imax;
+#define IMAX (INT_MAX < SIZE_MAX ? INT_MAX : (int)SIZE_MAX)
+               int nitems_max = IMAX - WORK_AROUND_QTBUG_53071;
+               int amax = nitems_max < IMAX ? nitems_max : IMAX;
                if ((amax - 1) / 3 * 2 < *nitems_alloc)
                        memory_exhausted(_("int overflow"));
                *nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;



Home | Main Index | Thread Index | Old Index