Module Name: src Committed By: christos Date: Tue Sep 20 15:03:07 UTC 2016
Modified Files: src/lib/libc/time: zic.c Log Message: use a define, and cast. To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/lib/libc/time/zic.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/zic.c diff -u src/lib/libc/time/zic.c:1.61 src/lib/libc/time/zic.c:1.62 --- src/lib/libc/time/zic.c:1.61 Tue Sep 20 09:09:08 2016 +++ src/lib/libc/time/zic.c Tue Sep 20 11:03:07 2016 @@ -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 @@ growalloc(void *ptr, size_t itemsize, in 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;