mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
cJSON_ConfigurationChangeFormat
This commit is contained in:
34
cJSON.c
34
cJSON.c
@ -2930,16 +2930,6 @@ CJSON_PUBLIC(cJSON_Configuration) cJSON_CreateConfiguration(const cJSON * const
|
||||
|
||||
/* then overwrite with other options if they exist */
|
||||
|
||||
option = get_object_item(json, "format", &global_configuration);
|
||||
if (cJSON_IsTrue(option))
|
||||
{
|
||||
configuration->format = true;
|
||||
}
|
||||
else if (cJSON_IsFalse(option))
|
||||
{
|
||||
configuration->format = false;
|
||||
}
|
||||
|
||||
option = get_object_item(json, "case_sensitive", &global_configuration);
|
||||
if (cJSON_IsTrue(option))
|
||||
{
|
||||
@ -3018,6 +3008,30 @@ CJSON_PUBLIC(cJSON_Configuration) cJSON_ConfigurationChangePrebufferSize(cJSON_C
|
||||
return configuration;
|
||||
}
|
||||
|
||||
CJSON_PUBLIC(cJSON_Configuration) cJSON_ConfigurationChangeFormat(cJSON_Configuration configuration, cJSON_Format format)
|
||||
{
|
||||
if (configuration == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (format)
|
||||
{
|
||||
case CJSON_FORMAT_MINIFIED:
|
||||
((internal_configuration*)configuration)->format = false;
|
||||
break;
|
||||
|
||||
case CJSON_FORMAT_DEFAULT:
|
||||
((internal_configuration*)configuration)->format = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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