8000 Another portability fix for tzcode2016g update. · skyline2012/postgres@aee5eb8 · GitHub
[go: up one dir, main page]

Skip to content

Commit aee5eb8

Browse files
committed
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.
1 parent fadfe66 commit aee5eb8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/timezone/zic.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,8 @@ growalloc(void *ptr, size_t itemsize, int nitems, int *nitems_alloc)
436436
else
437437
{
438438
int nitems_max = INT_MAX - WORK_AROUND_QTBUG_53071;
439-
int amax = nitems_max < SIZE_MAX ? nitems_max : SIZE_MAX;
440439

441-
if ((amax - 1) / 3 * 2 < *nitems_alloc)
440+
if ((nitems_max - 1) / 3 * 2 < *nitems_alloc)
442441
memory_exhausted(_("int overflow"));
443442
*nitems_alloc = *nitems_alloc + (*nitems_alloc >> 1) + 1;
444443
return erealloc(ptr, size_product(*nitems_alloc, itemsize));

0 commit comments

Comments
 (0)
0