summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlvaro Herrera2020-06-24 18:00:37 +0000
committerAlvaro Herrera2020-06-24 18:00:37 +0000
commit368d7f3297e7e1304da03904d2e1310d79fa82a9 (patch)
treec4a841651ab27070aca241df34a68bd96a9f71b6 /src
parenta3554b2d718520cbd16c13ff5c9f2e8257846170 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index a1256a103b6..34ede80c44f 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -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;