commit be88036: [Minor] Address svector destructor issue
Vsevolod Stakhov
vsevolod at rspamd.com
Tue Jul 19 19:21:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-07-19 20:18:40 +0100
URL: https://github.com/rspamd/rspamd/commit/be88036df9835105a1345949e902a0b5b1516441 (HEAD -> master)
[Minor] Address svector destructor issue
---
contrib/DEPENDENCY_INFO.md | 4 ++--
contrib/ankerl/svector.h | 15 ++++++++++-----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/contrib/DEPENDENCY_INFO.md b/contrib/DEPENDENCY_INFO.md
index 9c5cdb431..23234283b 100644
--- a/contrib/DEPENDENCY_INFO.md
+++ b/contrib/DEPENDENCY_INFO.md
@@ -35,5 +35,5 @@
| fmt | 8.1.1 | MIT | NO | |
| doctest | 2.4.6 | MIT | NO | |
| function2 | 4.1.0 | Boost | NO | |
-| ankerl/svector | 1.0.0 | MIT | NO | |
-| ankerl/unordered_dense | 1.0.2 | MIT | NO | |
\ No newline at end of file
+| ankerl/svector | 1.0.1 | MIT | NO | |
+| ankerl/unordered_dense | 1.0.2 | MIT | NO | |
diff --git a/contrib/ankerl/svector.h b/contrib/ankerl/svector.h
index b6ef1ad68..60edcfeab 100644
--- a/contrib/ankerl/svector.h
+++ b/contrib/ankerl/svector.h
@@ -1,5 +1,5 @@
// ┌─┐┬ ┬┌─┐┌─┐┌┬┐┌─┐┬─┐ Compact SVO optimized vector C++17 or higher
-// └─┐└┐┌┘├┤ │ │ │ │├┬┘ Version 1.0.0
+// └─┐└┐┌┘├┤ │ │ │ │├┬┘ Version 1.0.1
// └─┘ └┘ └─┘└─┘ ┴ └─┘┴└─ https://github.com/martinus/svector
//
// Licensed under the MIT License <http://opensource.org/licenses/MIT>.
@@ -30,7 +30,7 @@
// see https://semver.org/spec/v2.0.0.html
#define ANKERL_SVECTOR_VERSION_MAJOR 1 // incompatible API changes
#define ANKERL_SVECTOR_VERSION_MINOR 0 // add functionality in a backwards compatible manner
-#define ANKERL_SVECTOR_VERSION_PATCH 0 // backwards compatible bug fixes
+#define ANKERL_SVECTOR_VERSION_PATCH 1 // backwards compatible bug fixes
// API versioning with inline namespace, see https://www.foonathan.net/2018/11/inline-namespaces/
#define ANKERL_SVECTOR_VERSION_CONCAT1(major, minor, patch) v##major##_##minor##_##patch
@@ -272,7 +272,8 @@ class svector {
auto* storage = indirect();
uninitialized_move_and_destroy(storage->data(), direct_data(), storage->size());
set_direct_and_size(storage->size());
- delete storage;
+ std::destroy_at(storage);
+ ::operator delete(storage);
} else {
// put everything into indirect storage
auto* storage = detail::storage<T>::alloc(new_capacity);
@@ -284,7 +285,9 @@ class svector {
// indirect -> indirect
uninitialized_move_and_destroy(data<direction::indirect>(), storage->data(), size<direction::indirect>());
storage->size(size<direction::indirect>());
- delete indirect();
+ auto* storage = indirect();
+ std::destroy_at(storage);
+ ::operator delete(storage);
}
set_indirect(storage);
}
@@ -522,7 +525,9 @@ class svector {
std::destroy_n(ptr, s);
}
if (!is_dir) {
- delete indirect();
+ auto* storage = indirect();
+ std::destroy_at(storage);
+ ::operator delete(storage);
}
}
More information about the Commits
mailing list