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 | 411493d701e2f97e778dc1ff14fb7169eea2e94c (patch) | |
tree | 4cf89cc902b2a0bcf9d1250367aab43ae08ac5e8 /src | |
parent | bc4d7817e0cbd26998ebaa682772bf6bc579c302 (diff) | |
download | postgresql-411493d701e2f97e778dc1ff14fb7169eea2e94c.tar.gz postgresql-411493d701e2f97e778dc1ff14fb7169eea2e94c.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')
-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 55cac186dc7..aca4fdd2a66 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; |