From: Tom Lane Date: Thu, 20 Oct 2016 03:32:08 +0000 (-0400) Subject: Another portability fix for tzcode2016g update. X-Git-Tag: REL_10_BETA1~1537 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23ed2ba8121178474f8c51774c6c258cb165a562;p=postgresql Another portability fix for tzcode2016g update. clang points out that SIZE_MAX wouldn't fit into an int, which means this comparison is pretty useless. Per report from Thomas Munro. --- diff --git a/src/timezone/zic.c b/src/timezone/zic.c index 04f4df27ce..3f714ef46c 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -424,9 +424,8 @@ growalloc(void *ptr, size_t itemsize, int nitems, int *nitems_alloc) else { int nitems_max = INT_MAX - WORK_AROUND_QTBUG_53071; - int amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX; - if ((amax - 1) / 3 * 2 < *nitems_alloc) + if ((nitems_max - 1) / 3 * 2 < *nitems_alloc) memory_exhausted(_("int overflow")); *nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1; return erealloc(ptr, size_product(*nitems_alloc, itemsize));