postgres.git / summary / log / commit / refs
commit aee5eb8300ac8e37e5f32b87b499eba390ed4737
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu Oct 20 03:32:08 2016 +0000
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.
src/timezone/zic.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index 82311e6bd00..4ff819931a7 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -436,9 +436,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));
[parent: fadfe66497be]