aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-10-19 23:32:08 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-10-19 23:32:58 -0400
commit65935033d64cb5ad51f7e5967860d545400beccd (patch)
tree32dbc1df4e3a6e401dd8ac34f781109313ef7818
parentfba888a8779e16ae25c1443e3a7fdea44817c87c (diff)
downloadpostgresql-65935033d64cb5ad51f7e5967860d545400beccd.tar.gz
postgresql-65935033d64cb5ad51f7e5967860d545400beccd.zip
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.
-rw-r--r--src/timezone/zic.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index 22179e5b253..8c48ee9a6b6 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -432,9 +432,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));