1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-12 16:21:30 +03:00

Add parens to ConvertToXSegs macro

The current definition (introduced in 9a3215026bd6) is dangerous.  No
bugs exist in our code at present, but backpatch to 11 nonetheless,
where that commit debuted.

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
This commit is contained in:
Alvaro Herrera 2020-06-24 13:57:21 -04:00
parent 35a8e227e6
commit 5c215c941c
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE

View File

@ -738,9 +738,12 @@ static ControlFileData *ControlFile = NULL;
*/ */
#define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD) #define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD)
/* Convert min_wal_size_mb and max wal_size_mb to equivalent segment count */ /*
* Convert min_wal_size_mb and max wal_size_mb to equivalent segment count.
* Rounds down.
*/
#define ConvertToXSegs(x, segsize) \ #define ConvertToXSegs(x, segsize) \
(x / ((segsize) / (1024 * 1024))) ((x) / ((segsize) / (1024 * 1024)))
/* The number of bytes in a WAL segment usable for WAL data. */ /* The number of bytes in a WAL segment usable for WAL data. */
static int UsableBytesInSegment; static int UsableBytesInSegment;