Add copying utility methods to Arena
This commit is contained in:
@@ -76,13 +76,6 @@ private:
|
||||
Precondition current_precondition;
|
||||
Operation current_operation;
|
||||
|
||||
// Helper to store string in arena and return string_view
|
||||
std::string_view store_string(const char *str, size_t length) {
|
||||
char *stored = arena.allocate<char>(length);
|
||||
std::memcpy(stored, str, length);
|
||||
return std::string_view(stored, length);
|
||||
}
|
||||
|
||||
public:
|
||||
explicit CommitRequestArenaHandler()
|
||||
: preconditions(ArenaStlAllocator<Precondition>(&arena)),
|
||||
@@ -109,7 +102,7 @@ public:
|
||||
bool RawNumber(const char *, rapidjson::SizeType, bool) { abort(); }
|
||||
|
||||
bool String(const char *str, rapidjson::SizeType length, bool) {
|
||||
std::string_view value = store_string(str, length);
|
||||
std::string_view value = arena.copy_string({str, length});
|
||||
|
||||
if (state == State::Root) {
|
||||
if (current_key == "request_id") {
|
||||
|
||||
Reference in New Issue
Block a user