Skip to content

Commit 5c215c9

Browse files
committed
Add parens to ConvertToXSegs macro
The current definition (introduced in 9a32150) 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>
1 parent 35a8e22 commit 5c215c9

File tree

1 file changed

+5
-2
lines changed
  • src/backend/access/transam

1 file changed

+5
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,9 +738,12 @@ static ControlFileData *ControlFile = NULL;
738738
*/
739739
#define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD)
740740

741-
/* Convert min_wal_size_mb and max wal_size_mb to equivalent segment count */
741+
/*
742+
* Convert min_wal_size_mb and max wal_size_mb to equivalent segment count.
743+
* Rounds down.
744+
*/
742745
#define ConvertToXSegs(x, segsize) \
743-
(x / ((segsize) / (1024 * 1024)))
746+
((x) / ((segsize) / (1024 * 1024)))
744747

745748
/* The number of bytes in a WAL segment usable for WAL data. */
746749
static int UsableBytesInSegment;

0 commit comments

Comments
 (0)