cJSON_ConfigurationChangeAllowDataAfterJson

This commit is contained in:
Max Bruckner
2018-02-03 02:55:06 +01:00
parent 7e4ac634c6
commit d664199036
3 changed files with 28 additions and 14 deletions

24
cJSON.c
View File

@ -2893,7 +2893,6 @@ CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item)
CJSON_PUBLIC(cJSON_Configuration) cJSON_CreateConfiguration(const cJSON * const json, const cJSON_Allocators * const allocators, void *allocator_userdata)
{
internal_configuration *configuration = NULL;
cJSON *option = NULL;
const cJSON_Allocators *local_allocators = &global_configuration.allocators;
if (allocators != NULL)
@ -2928,18 +2927,6 @@ CJSON_PUBLIC(cJSON_Configuration) cJSON_CreateConfiguration(const cJSON * const
return configuration;
}
/* then overwrite with other options if they exist */
option = get_object_item(json, "allow_data_after_json", &global_configuration);
if (cJSON_IsTrue(option))
{
configuration->allow_data_after_json = true;
}
else if (cJSON_IsFalse(option))
{
configuration->allow_data_after_json = false;
}
return (cJSON_Configuration)configuration;
fail:
@ -3033,6 +3020,17 @@ CJSON_PUBLIC(cJSON_Configuration) cJSON_ConfigurationChangeCaseSensitivity(cJSON
return configuration;
}
CJSON_PUBLIC(cJSON_Configuration) cJSON_ConfigurationChangeAllowDataAfterJson(cJSON_Configuration configuration, cJSON_bool allow_data_after_json)
{
if (configuration == NULL)
{
return NULL;
}
((internal_configuration*)configuration)->allow_data_after_json = allow_data_after_json;
return configuration;
}
static cJSON_bool compare(const cJSON * const a, const cJSON * const b, const internal_configuration * const configuration)
{
if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a))