diff options
author | Nathan Bossart <nathan@postgresql.org> | 2024-02-16 14:05:36 -0600 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2024-02-16 14:05:36 -0600 |
commit | 3b42bdb47169c617cb79123c407a19d16458b49a (patch) | |
tree | 90b3448bf3d59ab3bdc5996f2bb43fc83bcfe458 /src/backend/utils/adt/oid.c | |
parent | 6b80394781c8de17fe7cae6996476088af3c319f (diff) |
Use new overflow-safe integer comparison functions.
Commit 6b80394781 introduced integer comparison functions designed
to be as efficient as possible while avoiding overflow. This
commit makes use of these functions in many of the in-tree qsort()
comparators to help ensure transitivity. Many of these comparator
functions should also see a small performance boost.
Author: Mats Kindahl
Reviewed-by: Andres Freund, FabrÃzio de Royes Mello
Discussion: https://postgr.es/m/CA%2B14426g2Wa9QuUpmakwPxXFWG_1FaY0AsApkvcTBy-YfS6uaw%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/oid.c')
-rw-r--r-- | src/backend/utils/adt/oid.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c index 62bcfc5b566..56fb1fd77ce 100644 --- a/src/backend/utils/adt/oid.c +++ b/src/backend/utils/adt/oid.c @@ -18,6 +18,7 @@ #include <limits.h> #include "catalog/pg_type.h" +#include "common/int.h" #include "libpq/pqformat.h" #include "nodes/miscnodes.h" #include "nodes/value.h" @@ -259,11 +260,7 @@ oid_cmp(const void *p1, const void *p2) Oid v1 = *((const Oid *) p1); Oid v2 = *((const Oid *) p2); - if (v1 < v2) - return -1; - if (v1 > v2) - return 1; - return 0; + return pg_cmp_u32(v1, v2); } |