1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

Use C library functions instead of Abs() for int64

Instead of Abs() for int64, use the C standard functions labs() or
llabs() as appropriate.  Define a small wrapper around them that
matches our definition of int64.  (labs() is C90, llabs() is C99.)

Reviewed-by: Zhang Mingli <zmlpostgres@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/4beb42b5-216b-bce8-d452-d924d5794c63%40enterprisedb.com
This commit is contained in:
Peter Eisentraut
2022-10-10 08:51:07 +02:00
parent 06dbd619bf
commit 357cfefb09
5 changed files with 16 additions and 7 deletions

View File

@ -564,7 +564,7 @@ pg_size_pretty(PG_FUNCTION_ARGS)
uint8 bits;
/* use this unit if there are no more units or we're below the limit */
if (unit[1].name == NULL || Abs(size) < unit->limit)
if (unit[1].name == NULL || i64abs(size) < unit->limit)
{
if (unit->round)
size = half_rounded(size);