diff options
author | Nathan Bossart | 2024-02-16 20:05:36 +0000 |
---|---|---|
committer | Nathan Bossart | 2024-02-16 20:05:36 +0000 |
commit | 3b42bdb47169c617cb79123c407a19d16458b49a (patch) | |
tree | 90b3448bf3d59ab3bdc5996f2bb43fc83bcfe458 /src/backend/postmaster/autovacuum.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/postmaster/autovacuum.c')
-rw-r--r-- | src/backend/postmaster/autovacuum.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 37998f73871..2ab344c1f8e 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -78,6 +78,7 @@ #include "catalog/pg_database.h" #include "commands/dbcommands.h" #include "commands/vacuum.h" +#include "common/int.h" #include "lib/ilist.h" #include "libpq/pqsignal.h" #include "miscadmin.h" @@ -1120,10 +1121,8 @@ rebuild_database_list(Oid newdb) static int db_comparator(const void *a, const void *b) { - if (((const avl_dbase *) a)->adl_score == ((const avl_dbase *) b)->adl_score) - return 0; - else - return (((const avl_dbase *) a)->adl_score < ((const avl_dbase *) b)->adl_score) ? 1 : -1; + return pg_cmp_s32(((const avl_dbase *) a)->adl_score, + ((const avl_dbase *) b)->adl_score); } /* |