commit ca367c4: [Fix] Symcache: Do not use C style comparators in C++ sorts
Vsevolod Stakhov
vsevolod at rspamd.com
Tue Jun 28 19:00:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-06-28 19:57:46 +0100
URL: https://github.com/rspamd/rspamd/commit/ca367c4a17dc6658d8a58122f6a28ced1b4afbb1 (HEAD -> master)
[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 479617c4a..52a2042b1 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");
More information about the Commits
mailing list