From ca367c4a17dc6658d8a58122f6a28ced1b4afbb1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 28 Jun 2022 19:57:46 +0100 Subject: [PATCH] [Fix] Symcache: Do not use C style comparators in C++ sorts --- src/libserver/symcache/symcache_impl.cxx | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/libserver/symcache/symcache_impl.cxx b/src/libserver/symcache/symcache_impl.cxx index 479617c4a4..52a2042b11 100644 --- a/src/libserver/symcache/symcache_impl.cxx +++ b/src/libserver/symcache/symcache_impl.cxx @@ -96,25 +96,11 @@ auto symcache::init() -> bool } /* Sorting stuff */ - auto postfilters_cmp = [](const auto &it1, const auto &it2) -> int { - if (it1->priority > it2->priority) { - return 1; - } - else if (it1->priority == it2->priority) { - return 0; - } - - return -1; + constexpr auto postfilters_cmp = [](const auto &it1, const auto &it2) -> bool { + return it1->priority < it2->priority; }; - auto prefilters_cmp = [](const auto &it1, const auto &it2) -> int { - if (it1->priority > it2->priority) { - return -1; - } - else if (it1->priority == it2->priority) { - return 0; - } - - return 1; + constexpr auto prefilters_cmp = [](const auto &it1, const auto &it2) -> bool { + return it1->priority > it2->priority; }; msg_debug_cache("sorting stuff"); -- 2.47.3