mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
cJSON_ConfigurationChangeAllowDataAfterJson
This commit is contained in:
24
cJSON.c
24
cJSON.c
@ -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))
|
||||
|
Reference in New Issue
Block a user