summaryrefslogtreecommitdiff
path: root/src/bin/psql/crosstabview.c
diff options
context:
space:
mode:
authorNathan Bossart2024-02-16 20:05:36 +0000
committerNathan Bossart2024-02-16 20:05:36 +0000
commit3b42bdb47169c617cb79123c407a19d16458b49a (patch)
tree90b3448bf3d59ab3bdc5996f2bb43fc83bcfe458 /src/bin/psql/crosstabview.c
parent6b80394781c8de17fe7cae6996476088af3c319f (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/bin/psql/crosstabview.c')
-rw-r--r--src/bin/psql/crosstabview.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/psql/crosstabview.c b/src/bin/psql/crosstabview.c
index c6116b7238e..305ed4ab0a8 100644
--- a/src/bin/psql/crosstabview.c
+++ b/src/bin/psql/crosstabview.c
@@ -8,6 +8,7 @@
#include "postgres_fe.h"
#include "common.h"
+#include "common/int.h"
#include "common/logging.h"
#include "crosstabview.h"
#include "pqexpbuffer.h"
@@ -709,5 +710,5 @@ pivotFieldCompare(const void *a, const void *b)
static int
rankCompare(const void *a, const void *b)
{
- return *((const int *) a) - *((const int *) b);
+ return pg_cmp_s32(*(const int *) a, *(const int *) b);
}