From: Vsevolod Stakhov Date: Tue, 28 Jun 2022 18:57:46 +0000 (+0100) Subject: [Fix] Symcache: Do not use C style comparators in C++ sorts X-Git-Tag: 3.3~169 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca367c4a17dc6658d8a58122f6a28ced1b4afbb1;p=thirdparty%2Frspamd.git [Fix] Symcache: Do not use C style comparators in C++ sorts --- 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");