cJSON_ParseWithOpts: Extract pasrse with internal_configuration

Also introduces a allow_data_after_json property in the internal
configuration.
This commit is contained in:
Max Bruckner
2018-02-01 01:24:36 +01:00
parent d4e81cfe57
commit f02f79ecbb
13 changed files with 64 additions and 51 deletions

View File

@ -418,7 +418,7 @@ static void *failing_realloc(void *pointer, size_t size)
static void ensure_should_fail_on_failed_realloc(void)
{
printbuffer buffer = {NULL, 10, 0, 0, false, {256, false, &malloc, &free, &failing_realloc}};
printbuffer buffer = {NULL, 10, 0, 0, false, {256, false, true, &malloc, &free, &failing_realloc}};
buffer.buffer = (unsigned char*)malloc(100);
TEST_ASSERT_NOT_NULL(buffer.buffer);
@ -428,7 +428,7 @@ static void ensure_should_fail_on_failed_realloc(void)
static void skip_utf8_bom_should_skip_bom(void)
{
const unsigned char string[] = "\xEF\xBB\xBF{}";
parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0, 0, 0 } };
parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0, 0, 0, 0 } };
buffer.content = string;
buffer.length = sizeof(string);
buffer.configuration = global_configuration;
@ -440,7 +440,7 @@ static void skip_utf8_bom_should_skip_bom(void)
static void skip_utf8_bom_should_not_skip_bom_if_not_at_beginning(void)
{
const unsigned char string[] = " \xEF\xBB\xBF{}";
parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0, 0, 0 } };
parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0, 0, 0, 0 } };
buffer.content = string;
buffer.length = sizeof(string);
buffer.configuration = global_configuration;