aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_string.hxx
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-01 20:24:20 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-01 20:24:20 +0100
commit11edb8d089395d439b0dd18f376c83404e9bebfd (patch)
tree031bd4eb073cf1b8b5c73536307743149d1a5ebd /src/libmime/mime_string.hxx
parent7ba0e69b2f31454f21b80e113737df968cc9862a (diff)
downloadrspamd-11edb8d089395d439b0dd18f376c83404e9bebfd.tar.gz
rspamd-11edb8d089395d439b0dd18f376c83404e9bebfd.zip
[Project] Allow mempool allocated mime strings
Diffstat (limited to 'src/libmime/mime_string.hxx')
-rw-r--r--src/libmime/mime_string.hxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libmime/mime_string.hxx b/src/libmime/mime_string.hxx
index 259788cd5..7474c6381 100644
--- a/src/libmime/mime_string.hxx
+++ b/src/libmime/mime_string.hxx
@@ -24,6 +24,7 @@
#include <cstdlib>
#include <cstring>
#include <iosfwd>
+#include "libutil/mem_pool.h"
#include "function2/function2.hpp"
#include "unicode/utf8.h"
#include "contrib/fastutf8/fastutf8.h"
@@ -42,6 +43,7 @@ template<class T=char, class Allocator = std::allocator<T>,
class Functor = fu2::function_view<UChar32(UChar32)>> class basic_mime_string;
using mime_string = basic_mime_string<char>;
+using mime_pool_string = basic_mime_string<char, mempool_allocator<char>>;
/* Helpers for type safe flags */
enum class mime_string_flags : std::uint8_t {
@@ -361,6 +363,16 @@ public:
append_c_string_unfiltered(other.data(), other.size());
}
}
+ auto assign_copy(const view_type &other) {
+ storage.clear();
+
+ if (filter_func) {
+ append_c_string_filtered(other.data(), other.size());
+ }
+ else {
+ append_c_string_unfiltered(other.data(), other.size());
+ }
+ }
/* Mutators */
auto append(const CharT* str, std::size_t size) -> std::size_t {