Just use stack allocations in parsing by default.

This commit is contained in:
Chris Marsh
2017-07-24 14:59:45 -07:00
parent 63058ddf23
commit 38c0599380
4 changed files with 59 additions and 30 deletions

View File

@@ -34,7 +34,10 @@ void RpcConnection::Open()
}
if (state == State::SentHandshake) {
JsonDocument message;
char parseBuffer[32 * 1024];
PoolAllocator pa(parseBuffer, sizeof(parseBuffer));
StackAllocator sa;
JsonDocument message(rapidjson::kObjectType, &pa, sizeof(sa.fixedBuffer_), &sa);
if (Read(message)) {
auto cmd = message.FindMember("cmd");
if (cmd == message.MemberEnd() || !cmd->value.IsString()) {