diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2025-03-28 14:05:45 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2025-03-28 14:34:57 +0100 |
commit | 2247281c470502c799fc2153a3583c025e894a9c (patch) | |
tree | a6f2bdb1f3d4f14018713d35e02b95019183eab7 | |
parent | 83ccc85859f30af44785b0dee830f7071d99ec4f (diff) | |
download | postgresql-2247281c470502c799fc2153a3583c025e894a9c.tar.gz postgresql-2247281c470502c799fc2153a3583c025e894a9c.zip |
Cast result of i64abs() back to int64
Without the cast, the return type could be long or long long,
depending on what int64 is underneath. This doesn't affect code
correctness, but it could result in format-mismatch warnings when
attempting to printf such values using PRId64.
Reported-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CA+hUKGJc4s+Wyb3EFOQNN9VVK+Qv40r2LK41o9PkS9ThxviTvQ@mail.gmail.com
-rw-r--r-- | src/include/c.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/c.h b/src/include/c.h index 72a3fd10b41..8cdc16a0f4a 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1278,9 +1278,9 @@ extern int fdatasync(int fildes); * Similarly, wrappers around labs()/llabs() matching our int64. */ #if SIZEOF_LONG == 8 -#define i64abs(i) labs(i) +#define i64abs(i) ((int64) labs(i)) #elif SIZEOF_LONG_LONG == 8 -#define i64abs(i) llabs(i) +#define i64abs(i) ((int64) llabs(i)) #else #error "cannot find integer type of the same size as int64_t" #endif |