Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 368d7f3

Browse files
committed
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>
1 parent a3554b2 commit 368d7f3

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
@@ -760,9 +760,12 @@ static ControlFileData *ControlFile = NULL;
760760
*/
761761
#define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD)
762762

763-
/* Convert values of GUCs measured in megabytes to equiv. segment count */
763+
/*
764+
* Convert values of GUCs measured in megabytes to equiv. segment count.
765+
* Rounds down.
766+
*/
764767
#define ConvertToXSegs(x, segsize) \
765-
(x / ((segsize) / (1024 * 1024)))
768+
((x) / ((segsize) / (1024 * 1024)))
766769

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

0 commit comments

Comments
 (0)