commit 788b7d3: [Minor] Add a workaround for old clang
Vsevolod Stakhov
vsevolod at rspamd.com
Mon Jul 18 16:35:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-07-18 17:32:16 +0100
URL: https://github.com/rspamd/rspamd/commit/788b7d345fa116646c5e240f942c79febcdb7443 (HEAD -> master)
[Minor] Add a workaround for old clang
---
src/libserver/symcache/symcache_impl.cxx | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/libserver/symcache/symcache_impl.cxx b/src/libserver/symcache/symcache_impl.cxx
index fe879810b..8ffc55db0 100644
--- a/src/libserver/symcache/symcache_impl.cxx
+++ b/src/libserver/symcache/symcache_impl.cxx
@@ -24,6 +24,7 @@
#include "fmt/core.h"
#include "contrib/t1ha/t1ha.h"
+#include <version>
#include <cmath>
namespace rspamd::symcache {
@@ -145,9 +146,17 @@ auto symcache::init() -> bool
items_by_symbol.erase(deleted_element_refcount->get_name());
auto &additional_vec = get_item_specific_vector(*deleted_element_refcount);
+#if __cplusplus >= 202002L || defined(__cpp_lib_erase_if)
std::erase_if(additional_vec, [id_to_disable](const cache_item_ptr &elt) {
return elt->id == id_to_disable;
});
+#else
+ auto it = std::remove_if(additional_vec.begin(),
+ additional_vec.end(), [id_to_disable](const cache_item_ptr &elt) {
+ return elt->id == id_to_disable;
+ });
+ additional_vec.erase(it, additional_vec.end());
+#endif
/* Refcount is dropped, so the symbol should be freed, ensure that nothing else owns this symbol */
g_assert(deleted_element_refcount.use_count() == 1);
More information about the Commits
mailing list