diff options
Diffstat (limited to 'src/backend/utils/adt/mac.c')
-rw-r--r-- | src/backend/utils/adt/mac.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c index 88a1698cf96..ac7342cfca7 100644 --- a/src/backend/utils/adt/mac.c +++ b/src/backend/utils/adt/mac.c @@ -44,7 +44,6 @@ typedef struct static int macaddr_cmp_internal(macaddr *a1, macaddr *a2); static int macaddr_fast_cmp(Datum x, Datum y, SortSupport ssup); -static int macaddr_cmp_abbrev(Datum x, Datum y, SortSupport ssup); static bool macaddr_abbrev_abort(int memtupcount, SortSupport ssup); static Datum macaddr_abbrev_convert(Datum original, SortSupport ssup); @@ -381,7 +380,7 @@ macaddr_sortsupport(PG_FUNCTION_ARGS) ssup->ssup_extra = uss; - ssup->comparator = macaddr_cmp_abbrev; + ssup->comparator = ssup_datum_unsigned_cmp; ssup->abbrev_converter = macaddr_abbrev_convert; ssup->abbrev_abort = macaddr_abbrev_abort; ssup->abbrev_full_comparator = macaddr_fast_cmp; @@ -406,22 +405,6 @@ macaddr_fast_cmp(Datum x, Datum y, SortSupport ssup) } /* - * SortSupport abbreviated key comparison function. Compares two MAC addresses - * quickly by treating them like integers, and without having to go to the - * heap. - */ -static int -macaddr_cmp_abbrev(Datum x, Datum y, SortSupport ssup) -{ - if (x > y) - return 1; - else if (x == y) - return 0; - else - return -1; -} - -/* * Callback for estimating effectiveness of abbreviated key optimization. * * We pay no attention to the cardinality of the non-abbreviated data, because @@ -537,8 +520,8 @@ macaddr_abbrev_convert(Datum original, SortSupport ssup) /* * Byteswap on little-endian machines. * - * This is needed so that macaddr_cmp_abbrev() (an unsigned integer 3-way - * comparator) works correctly on all platforms. Without this, the + * This is needed so that ssup_datum_unsigned_cmp() (an unsigned integer + * 3-way comparator) works correctly on all platforms. Without this, the * comparator would have to call memcmp() with a pair of pointers to the * first byte of each abbreviated key, which is slower. */ |