mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -106,7 +106,7 @@ cash_dist(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||
errmsg("money out of range")));
|
||||
|
||||
ra = Abs(r);
|
||||
ra = i64abs(r);
|
||||
|
||||
PG_RETURN_CASH(ra);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ int8_dist(PG_FUNCTION_ARGS)
|
||||
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
|
||||
errmsg("bigint out of range")));
|
||||
|
||||
ra = Abs(r);
|
||||
ra = i64abs(r);
|
||||
|
||||
PG_RETURN_INT64(ra);
|
||||
}
|
||||
|
Reference in New Issue
Block a user