Add parens to ConvertToXSegs macro

The current definition is dangerous.  No bugs exist in our code at
present, but backpatch to 11 nonetheless where it was introduced.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
This commit is contained in:
Alvaro Herrera 2020-06-24 14:00:37 -04:00
parent a3554b2d71
commit 368d7f3297
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
1 changed files with 5 additions and 2 deletions

View File

@ -760,9 +760,12 @@ static ControlFileData *ControlFile = NULL;
*/
#define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD)
/* Convert values of GUCs measured in megabytes to equiv. segment count */
/*
* Convert values of GUCs measured in megabytes to equiv. segment count.
* Rounds down.
*/
#define ConvertToXSegs(x, segsize) \
(x / ((segsize) / (1024 * 1024)))
((x) / ((segsize) / (1024 * 1024)))
/* The number of bytes in a WAL segment usable for WAL data. */
static int UsableBytesInSegment;