Allow changing buffer size
I have a pretty memory-tight application and the parser buffer size of 512 was way overkill for my use-case (the largest individual keys/values are around 20 chars). I'm apparently not the first to have this issue. #19
This PR allows you to override the buffer size, either through build flags or by defining the prop before the library is imported:
#define JSON_PARSER_BUFFER_MAX_LENGTH 128
#include <JsonStreamingParser.h>
I renamed the definition to reduce the chance of conflicts with definitions in other code.
Note: you'll also need to modify increaseBufferPointer() in JsonStreamingParser.cpp, which also refers to BUFFER_MAX_LENGTH:
void JsonStreamingParser::increaseBufferPointer() {
bufferPos = min(bufferPos + 1, BUFFER_MAX_LENGTH - 1);
}
@ircmaxell thanks for the heads up, that function got changed: https://github.com/squix78/json-streaming-parser/pull/27/files#diff-5a1f311800a154b95827c7c76e82f0c1R205
Can you raise a pull request for
https://github.com/mrfaptastic/json-streaming-parser2
Because this library isn't maintained anymore it seems .