]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Symcache: Do not use C style comparators in C++ sorts
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 28 Jun 2022 18:57:46 +0000 (19:57 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 28 Jun 2022 18:57:46 +0000 (19:57 +0100)
src/libserver/symcache/symcache_impl.cxx

index 479617c4a4acd66a35b994d8fbdc21166205718c..52a2042b119a1adecf41ad0bcaa5759725434947 100644 (file)
@@ -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");