diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-06-24 14:00:37 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-06-24 14:00:37 -0400 |
commit | 368d7f3297e7e1304da03904d2e1310d79fa82a9 (patch) | |
tree | c4a841651ab27070aca241df34a68bd96a9f71b6 /src/backend/access/transam/xlog.c | |
parent | a3554b2d718520cbd16c13ff5c9f2e8257846170 (diff) | |
download | postgresql-368d7f3297e7e1304da03904d2e1310d79fa82a9.tar.gz postgresql-368d7f3297e7e1304da03904d2e1310d79fa82a9.zip |
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/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 7 |
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; |