27 #if !defined(_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) 28 #define _CRT_SECURE_NO_DEPRECATE 32 #pragma GCC visibility push(default) 35 #pragma warning (push) 37 #pragma warning (disable : 4001) 56 #pragma GCC visibility pop 65 #define true ((cJSON_bool)1) 70 #define false ((cJSON_bool)0) 74 #define isinf(d) (isnan((d - d)) && !isnan(d)) 77 #define isnan(d) (d != d) 88 static error global_error = { NULL, 0 };
92 return (
const char*) (global_error.
json + global_error.
position);
97 if (!cJSON_IsString(item))
107 if (!cJSON_IsNumber(item))
116 #if (CJSON_VERSION_MAJOR != 1) || (CJSON_VERSION_MINOR != 7) || (CJSON_VERSION_PATCH != 14) 117 #error cJSON.h and cJSON.c have different versions. Make sure that both have the same. 131 if ((string1 == NULL) || (string2 == NULL))
136 if (string1 == string2)
141 for(; tolower(*string1) == tolower(*string2); (void)string1++, string2++)
143 if (*string1 ==
'\0')
149 return tolower(*string1) - tolower(*string2);
156 void *(
CJSON_CDECL *reallocate)(
void *pointer,
size_t size);
159 #if defined(_MSC_VER) 174 #define internal_malloc malloc 175 #define internal_free free 176 #define internal_realloc realloc 180 #define static_strlen(string_literal) (sizeof(string_literal) - sizeof("")) 187 unsigned char *copy = NULL;
194 length = strlen((
const char*)
string) +
sizeof(
"");
195 copy = (
unsigned char*)hooks->
allocate(length);
200 memcpy(copy,
string, length);
211 global_hooks.deallocate =
free;
222 global_hooks.deallocate =
free;
223 if (hooks->free_fn != NULL)
225 global_hooks.deallocate = hooks->free_fn;
242 memset(node,
'\0',
sizeof(
cJSON));
257 cJSON_Delete(item->
child);
265 global_hooks.deallocate(item->
string);
267 global_hooks.deallocate(item);
275 #ifdef ENABLE_LOCALES 276 struct lconv *lconv = localeconv();
277 return (
unsigned char) lconv->decimal_point[0];
293 #define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length)) 295 #define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length)) 296 #define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index)) 298 #define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset) 304 unsigned char *after_end = NULL;
305 unsigned char number_c_string[64];
309 if ((input_buffer == NULL) || (input_buffer->
content == NULL))
317 for (i = 0; (i < (
sizeof(number_c_string) - 1)) &&
can_access_at_index(input_buffer, i); i++)
339 number_c_string[
i] = decimal_point;
347 number_c_string[
i] =
'\0';
349 number = strtod((
const char*)number_c_string, (
char**)&after_end);
350 if (number_c_string == after_end)
358 if (number >= INT_MAX)
362 else if (number <= (
double)INT_MIN)
373 input_buffer->
offset += (size_t)(after_end - number_c_string);
380 if (number >= INT_MAX)
382 object->valueint = INT_MAX;
384 else if (number <= (
double)INT_MIN)
386 object->valueint = INT_MIN;
390 object->valueint = (int)number;
393 return object->valuedouble =
number;
404 if (strlen(valuestring) <= strlen(object->
valuestring))
407 return object->valuestring;
418 object->valuestring = copy;
437 unsigned char *newbuffer = NULL;
440 if ((p == NULL) || (p->
buffer == NULL))
451 if (needed > INT_MAX)
468 if (needed > (INT_MAX / 2))
471 if (needed <= INT_MAX)
482 newsize = needed * 2;
489 if (newbuffer == NULL)
519 return newbuffer + p->
offset;
525 const unsigned char *buffer_pointer = NULL;
526 if ((buffer == NULL) || (buffer->
buffer == NULL))
532 buffer->
offset += strlen((
const char*)buffer_pointer);
539 return (
fabs(a - b) <= maxVal * DBL_EPSILON);
545 unsigned char *output_pointer = NULL;
549 unsigned char number_buffer[26] = {0};
553 if (output_buffer == NULL)
561 length = sprintf((
char*)number_buffer,
"null");
566 length = sprintf((
char*)number_buffer,
"%1.15g", d);
569 if ((sscanf((
char*)number_buffer,
"%lg", &test) != 1) || !
compare_double((
double)test, d))
572 length = sprintf((
char*)number_buffer,
"%1.17g", d);
577 if ((length < 0) || (length > (
int)(
sizeof(number_buffer) - 1)))
583 output_pointer =
ensure(output_buffer, (
size_t)length +
sizeof(
""));
584 if (output_pointer == NULL)
591 for (i = 0; i < ((size_t)length); i++)
593 if (number_buffer[i] == decimal_point)
595 output_pointer[
i] =
'.';
599 output_pointer[
i] = number_buffer[
i];
601 output_pointer[
i] =
'\0';
603 output_buffer->
offset += (size_t)length;
609 static unsigned parse_hex4(
const unsigned char *
const input)
614 for (i = 0; i < 4; i++)
617 if ((input[i] >=
'0') && (input[i] <=
'9'))
619 h += (
unsigned int) input[i] -
'0';
621 else if ((input[i] >=
'A') && (input[
i] <=
'F'))
623 h += (
unsigned int) 10 + input[i] -
'A';
625 else if ((input[i] >=
'a') && (input[
i] <=
'f'))
627 h += (
unsigned int) 10 + input[i] -
'a';
646 static unsigned char utf16_literal_to_utf8(
const unsigned char *
const input_pointer,
const unsigned char *
const input_end,
unsigned char **output_pointer)
648 long unsigned int codepoint = 0;
649 unsigned int first_code = 0;
650 const unsigned char *first_sequence = input_pointer;
651 unsigned char utf8_length = 0;
652 unsigned char utf8_position = 0;
653 unsigned char sequence_length = 0;
654 unsigned char first_byte_mark = 0;
656 if ((input_end - first_sequence) < 6)
666 if (((first_code >= 0xDC00) && (first_code <= 0xDFFF)))
672 if ((first_code >= 0xD800) && (first_code <= 0xDBFF))
674 const unsigned char *second_sequence = first_sequence + 6;
675 unsigned int second_code = 0;
676 sequence_length = 12;
678 if ((input_end - second_sequence) < 6)
684 if ((second_sequence[0] !=
'\\') || (second_sequence[1] !=
'u'))
691 second_code =
parse_hex4(second_sequence + 2);
693 if ((second_code < 0xDC00) || (second_code > 0xDFFF))
701 codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF));
706 codepoint = first_code;
712 if (codepoint < 0x80)
717 else if (codepoint < 0x800)
721 first_byte_mark = 0xC0;
723 else if (codepoint < 0x10000)
727 first_byte_mark = 0xE0;
729 else if (codepoint <= 0x10FFFF)
733 first_byte_mark = 0xF0;
742 for (utf8_position = (
unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--)
745 (*output_pointer)[utf8_position] = (
unsigned char)((codepoint | 0x80) & 0xBF);
751 (*output_pointer)[0] = (
unsigned char)((codepoint | first_byte_mark) & 0xFF);
755 (*output_pointer)[0] = (
unsigned char)(codepoint & 0x7F);
758 *output_pointer += utf8_length;
760 return sequence_length;
771 unsigned char *output_pointer = NULL;
772 unsigned char *output = NULL;
782 size_t allocation_length = 0;
783 size_t skipped_bytes = 0;
784 while (((
size_t)(input_end - input_buffer->
content) < input_buffer->
length) && (*input_end !=
'\"'))
787 if (input_end[0] ==
'\\')
789 if ((
size_t)(input_end + 1 - input_buffer->
content) >= input_buffer->
length)
799 if (((
size_t)(input_end - input_buffer->
content) >= input_buffer->
length) || (*input_end !=
'\"'))
805 allocation_length = (size_t) (input_end -
buffer_at_offset(input_buffer)) - skipped_bytes;
806 output = (
unsigned char*)input_buffer->
hooks.
allocate(allocation_length +
sizeof(
""));
813 output_pointer = output;
815 while (input_pointer < input_end)
817 if (*input_pointer !=
'\\')
819 *output_pointer++ = *input_pointer++;
824 unsigned char sequence_length = 2;
825 if ((input_end - input_pointer) < 1)
830 switch (input_pointer[1])
833 *output_pointer++ =
'\b';
836 *output_pointer++ =
'\f';
839 *output_pointer++ =
'\n';
842 *output_pointer++ =
'\r';
845 *output_pointer++ =
'\t';
850 *output_pointer++ = input_pointer[1];
856 if (sequence_length == 0)
866 input_pointer += sequence_length;
871 *output_pointer =
'\0';
876 input_buffer->
offset = (size_t) (input_end - input_buffer->
content);
884 input_buffer->
hooks.deallocate(output);
887 if (input_pointer != NULL)
889 input_buffer->
offset = (size_t)(input_pointer - input_buffer->
content);
898 const unsigned char *input_pointer = NULL;
899 unsigned char *output = NULL;
900 unsigned char *output_pointer = NULL;
901 size_t output_length = 0;
903 size_t escape_characters = 0;
905 if (output_buffer == NULL)
913 output =
ensure(output_buffer,
sizeof(
"\"\""));
918 strcpy((
char*)output,
"\"\"");
924 for (input_pointer = input; *input_pointer; input_pointer++)
926 switch (*input_pointer)
939 if (*input_pointer < 32)
942 escape_characters += 5;
947 output_length = (size_t)(input_pointer - input) + escape_characters;
949 output =
ensure(output_buffer, output_length +
sizeof(
"\"\""));
956 if (escape_characters == 0)
959 memcpy(output + 1, input, output_length);
960 output[output_length + 1] =
'\"';
961 output[output_length + 2] =
'\0';
967 output_pointer = output + 1;
969 for (input_pointer = input; *input_pointer !=
'\0'; (void)input_pointer++, output_pointer++)
971 if ((*input_pointer > 31) && (*input_pointer !=
'\"') && (*input_pointer !=
'\\'))
974 *output_pointer = *input_pointer;
979 *output_pointer++ =
'\\';
980 switch (*input_pointer)
983 *output_pointer =
'\\';
986 *output_pointer =
'\"';
989 *output_pointer =
'b';
992 *output_pointer =
'f';
995 *output_pointer =
'n';
998 *output_pointer =
'r';
1001 *output_pointer =
't';
1005 sprintf((
char*)output_pointer,
"u%04x", *input_pointer);
1006 output_pointer += 4;
1011 output[output_length + 1] =
'\"';
1012 output[output_length + 2] =
'\0';
1034 if ((buffer == NULL) || (buffer->
content == NULL))
1060 if ((buffer == NULL) || (buffer->
content == NULL) || (buffer->
offset != 0))
1083 buffer_length = strlen(value) +
sizeof(
"");
1085 return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated);
1095 global_error.
json = NULL;
1121 if (require_null_terminated)
1145 local_error.
json = (
const unsigned char*)
value;
1152 else if (buffer.
length > 0)
1162 global_error = local_error;
1171 return cJSON_ParseWithOpts(value, 0, 0);
1176 return cJSON_ParseWithLengthOpts(
value, buffer_length, 0, 0);
1179 #define cjson_min(a, b) (((a) < (b)) ? (a) : (b)) 1183 static const size_t default_buffer_size = 256;
1185 unsigned char *printed = NULL;
1187 memset(buffer, 0,
sizeof(buffer));
1190 buffer->
buffer = (
unsigned char*) hooks->
allocate(default_buffer_size);
1191 buffer->
length = default_buffer_size;
1193 buffer->
hooks = *hooks;
1194 if (buffer->
buffer == NULL)
1210 if (printed == NULL) {
1218 if (printed == NULL)
1223 printed[buffer->
offset] =
'\0';
1226 hooks->deallocate(buffer->
buffer);
1232 if (buffer->
buffer != NULL)
1234 hooks->deallocate(buffer->
buffer);
1237 if (printed != NULL)
1239 hooks->deallocate(printed);
1248 return (
char*)
print(item,
true, &global_hooks);
1253 return (
char*)
print(item,
false, &global_hooks);
1258 printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
1271 p.
length = (size_t)prebuffer;
1279 global_hooks.deallocate(p.
buffer);
1288 printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
1290 if ((length < 0) || (buffer == NULL))
1295 p.
buffer = (
unsigned char*)buffer;
1296 p.
length = (size_t)length;
1308 if ((input_buffer == NULL) || (input_buffer->
content == NULL))
1318 input_buffer->
offset += 4;
1325 input_buffer->
offset += 5;
1333 input_buffer->
offset += 4;
1363 unsigned char *output = NULL;
1365 if ((item == NULL) || (output_buffer == NULL))
1370 switch ((item->
type) & 0xFF)
1373 output =
ensure(output_buffer, 5);
1378 strcpy((
char*)output,
"null");
1382 output =
ensure(output_buffer, 6);
1387 strcpy((
char*)output,
"false");
1391 output =
ensure(output_buffer, 5);
1396 strcpy((
char*)output,
"true");
1404 size_t raw_length = 0;
1410 raw_length = strlen(item->
valuestring) +
sizeof(
"");
1411 output =
ensure(output_buffer, raw_length);
1438 cJSON *current_item = NULL;
1444 input_buffer->
depth++;
1474 if (new_item == NULL)
1483 current_item = head = new_item;
1488 current_item->
next = new_item;
1489 new_item->
prev = current_item;
1490 current_item = new_item;
1510 input_buffer->
depth--;
1513 head->
prev = current_item;
1535 unsigned char *output_pointer = NULL;
1539 if (output_buffer == NULL)
1546 output_pointer =
ensure(output_buffer, 1);
1547 if (output_pointer == NULL)
1552 *output_pointer =
'[';
1554 output_buffer->
depth++;
1556 while (current_element != NULL)
1563 if (current_element->
next)
1565 length = (size_t) (output_buffer->
format ? 2 : 1);
1566 output_pointer =
ensure(output_buffer, length + 1);
1567 if (output_pointer == NULL)
1571 *output_pointer++ =
',';
1572 if(output_buffer->
format)
1574 *output_pointer++ =
' ';
1576 *output_pointer =
'\0';
1579 current_element = current_element->
next;
1582 output_pointer =
ensure(output_buffer, 2);
1583 if (output_pointer == NULL)
1587 *output_pointer++ =
']';
1588 *output_pointer =
'\0';
1589 output_buffer->
depth--;
1598 cJSON *current_item = NULL;
1604 input_buffer->
depth++;
1632 if (new_item == NULL)
1641 current_item = head = new_item;
1646 current_item->
next = new_item;
1647 new_item->
prev = current_item;
1648 current_item = new_item;
1686 input_buffer->
depth--;
1689 head->
prev = current_item;
1710 unsigned char *output_pointer = NULL;
1714 if (output_buffer == NULL)
1720 length = (size_t) (output_buffer->
format ? 2 : 1);
1721 output_pointer =
ensure(output_buffer, length + 1);
1722 if (output_pointer == NULL)
1727 *output_pointer++ =
'{';
1728 output_buffer->
depth++;
1729 if (output_buffer->
format)
1731 *output_pointer++ =
'\n';
1735 while (current_item)
1737 if (output_buffer->
format)
1740 output_pointer =
ensure(output_buffer, output_buffer->
depth);
1741 if (output_pointer == NULL)
1745 for (i = 0; i < output_buffer->
depth; i++)
1747 *output_pointer++ =
'\t';
1759 length = (size_t) (output_buffer->
format ? 2 : 1);
1760 output_pointer =
ensure(output_buffer, length);
1761 if (output_pointer == NULL)
1765 *output_pointer++ =
':';
1766 if (output_buffer->
format)
1768 *output_pointer++ =
'\t';
1780 length = ((size_t)(output_buffer->
format ? 1 : 0) + (size_t)(current_item->
next ? 1 : 0));
1781 output_pointer =
ensure(output_buffer, length + 1);
1782 if (output_pointer == NULL)
1786 if (current_item->
next)
1788 *output_pointer++ =
',';
1791 if (output_buffer->
format)
1793 *output_pointer++ =
'\n';
1795 *output_pointer =
'\0';
1798 current_item = current_item->
next;
1801 output_pointer =
ensure(output_buffer, output_buffer->
format ? (output_buffer->
depth + 1) : 2);
1802 if (output_pointer == NULL)
1806 if (output_buffer->
format)
1809 for (i = 0; i < (output_buffer->
depth - 1); i++)
1811 *output_pointer++ =
'\t';
1814 *output_pointer++ =
'}';
1815 *output_pointer =
'\0';
1816 output_buffer->
depth--;
1824 cJSON *child = NULL;
1832 child = array->
child;
1834 while(child != NULL)
1837 child = child->
next;
1847 cJSON *current_child = NULL;
1854 current_child = array->
child;
1855 while ((current_child != NULL) && (index > 0))
1858 current_child = current_child->
next;
1861 return current_child;
1876 cJSON *current_element = NULL;
1878 if ((
object == NULL) || (name == NULL))
1883 current_element =
object->
child;
1886 while ((current_element != NULL) && (current_element->
string != NULL) && (strcmp(name, current_element->
string) != 0))
1888 current_element = current_element->
next;
1893 while ((current_element != NULL) && (
case_insensitive_strcmp((
const unsigned char*)name, (
const unsigned char*)(current_element->
string)) != 0))
1895 current_element = current_element->
next;
1899 if ((current_element == NULL) || (current_element->
string == NULL)) {
1903 return current_element;
1911 CJSON_PUBLIC(
cJSON *) cJSON_GetObjectItemCaseSensitive(
const cJSON *
const object,
const char *
const string)
1918 return cJSON_GetObjectItem(
object,
string) ? 1 : 0;
1931 cJSON *reference = NULL;
1938 if (reference == NULL)
1943 memcpy(reference, item,
sizeof(
cJSON));
1944 reference->
string = NULL;
1946 reference->
next = reference->
prev = NULL;
1952 cJSON *child = NULL;
1954 if ((item == NULL) || (array == NULL) || (array == item))
1959 child = array->
child;
1989 #if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) 1990 #pragma GCC diagnostic push 1993 #pragma GCC diagnostic ignored "-Wcast-qual" 2000 #if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ > 5)))) 2001 #pragma GCC diagnostic pop 2007 char *new_key = NULL;
2010 if ((
object == NULL) || (
string == NULL) || (item == NULL) || (
object == item))
2023 if (new_key == NULL)
2033 hooks->deallocate(item->
string);
2037 item->
type = new_type;
2065 if ((
object == NULL) || (
string == NULL))
2087 cJSON *true_item = cJSON_CreateTrue();
2093 cJSON_Delete(true_item);
2099 cJSON *false_item = cJSON_CreateFalse();
2105 cJSON_Delete(false_item);
2111 cJSON *bool_item = cJSON_CreateBool(
boolean);
2117 cJSON_Delete(bool_item);
2123 cJSON *number_item = cJSON_CreateNumber(number);
2129 cJSON_Delete(number_item);
2135 cJSON *string_item = cJSON_CreateString(
string);
2141 cJSON_Delete(string_item);
2147 cJSON *raw_item = cJSON_CreateRaw(raw);
2153 cJSON_Delete(raw_item);
2159 cJSON *object_item = cJSON_CreateObject();
2165 cJSON_Delete(object_item);
2171 cJSON *array = cJSON_CreateArray();
2177 cJSON_Delete(array);
2183 if ((parent == NULL) || (item == NULL))
2188 if (item != parent->
child)
2193 if (item->
next != NULL)
2199 if (item == parent->
child)
2204 else if (item->
next == NULL)
2224 return cJSON_DetachItemViaPointer(array,
get_array_item(array, (
size_t)which));
2229 cJSON_Delete(cJSON_DetachItemFromArray(array, which));
2234 cJSON *to_detach = cJSON_GetObjectItem(
object,
string);
2236 return cJSON_DetachItemViaPointer(
object, to_detach);
2241 cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(
object,
string);
2243 return cJSON_DetachItemViaPointer(
object, to_detach);
2246 CJSON_PUBLIC(
void) cJSON_DeleteItemFromObject(
cJSON *
object,
const char *
string)
2248 cJSON_Delete(cJSON_DetachItemFromObject(
object,
string));
2251 CJSON_PUBLIC(
void) cJSON_DeleteItemFromObjectCaseSensitive(
cJSON *
object,
const char *
string)
2253 cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(
object,
string));
2259 cJSON *after_inserted = NULL;
2267 if (after_inserted == NULL)
2272 newitem->
next = after_inserted;
2273 newitem->
prev = after_inserted->
prev;
2275 if (after_inserted == array->
child)
2288 if ((parent == NULL) || (replacement == NULL) || (item == NULL))
2293 if (replacement == item)
2301 if (replacement->
next != NULL)
2305 if (parent->
child == item)
2318 if (replacement->
prev != NULL)
2322 if (replacement->
next == NULL)
2347 if ((replacement == NULL) || (
string == NULL))
2355 cJSON_free(replacement->
string);
2360 return cJSON_ReplaceItemViaPointer(
object,
get_object_item(
object,
string, case_sensitive), replacement);
2431 else if (num <= (
double)INT_MIN)
2541 if ((count < 0) || (numbers == NULL))
2546 a = cJSON_CreateArray();
2547 for(i = 0; a && (i < (size_t)count); i++)
2549 n = cJSON_CreateNumber(numbers[i]);
2577 if ((count < 0) || (numbers == NULL))
2582 a = cJSON_CreateArray();
2584 for(i = 0; a && (i < (size_t)count); i++)
2586 n = cJSON_CreateNumber((
double)numbers[i]);
2614 if ((count < 0) || (numbers == NULL))
2619 a = cJSON_CreateArray();
2621 for(i = 0;a && (i < (size_t)count); i++)
2623 n = cJSON_CreateNumber(numbers[i]);
2651 if ((count < 0) || (strings == NULL))
2656 a = cJSON_CreateArray();
2658 for (i = 0; a && (i < (size_t)count); i++)
2660 n = cJSON_CreateString(strings[i]);
2684 cJSON *newitem = NULL;
2685 cJSON *child = NULL;
2687 cJSON *newchild = NULL;
2726 child = item->
child;
2727 while (child != NULL)
2729 newchild = cJSON_Duplicate(child,
true);
2737 next->
next = newchild;
2738 newchild->
prev = next;
2744 newitem->
child = newchild;
2747 child = child->
next;
2749 if (newitem && newitem->
child)
2757 if (newitem != NULL)
2759 cJSON_Delete(newitem);
2769 for (; (*input)[0] !=
'\0'; ++(*input))
2771 if ((*input)[0] ==
'\n') {
2782 for (; (*input)[0] !=
'\0'; ++(*input))
2784 if (((*input)[0] ==
'*') && ((*input)[1] ==
'/'))
2793 (*output)[0] = (*input)[0];
2798 for (; (*input)[0] !=
'\0'; (void)++(*input), ++(*output)) {
2799 (*output)[0] = (*input)[0];
2801 if ((*input)[0] ==
'\"') {
2802 (*output)[0] =
'\"';
2806 }
else if (((*input)[0] ==
'\\') && ((*input)[1] ==
'\"')) {
2807 (*output)[1] = (*input)[1];
2823 while (json[0] !=
'\0')
2839 else if (json[1] ==
'*')
2964 if ((a == NULL) || (b == NULL) || ((a->
type & 0xFF) != (b->
type & 0xFF)) || cJSON_IsInvalid(a))
2970 switch (a->
type & 0xFF)
2992 switch (a->
type & 0xFF)
3025 for (; (a_element != NULL) && (b_element != NULL);)
3027 if (!cJSON_Compare(a_element, b_element, case_sensitive))
3032 a_element = a_element->
next;
3033 b_element = b_element->
next;
3037 if (a_element != b_element) {
3046 cJSON *a_element = NULL;
3047 cJSON *b_element = NULL;
3052 if (b_element == NULL)
3057 if (!cJSON_Compare(a_element, b_element, case_sensitive))
3068 if (a_element == NULL)
3073 if (!cJSON_Compare(b_element, a_element, case_sensitive))
3089 return global_hooks.
allocate(size);
3094 global_hooks.deallocate(
object);
#define static_strlen(string_literal)
#define cJSON_ArrayForEach(element, array)
static cJSON_bool parse_string(cJSON *const item, parse_buffer *const input_buffer)
void *CJSON_CDECL * allocate(size_t size)
void *CJSON_CDECL * reallocate(void *pointer, size_t size)
static unsigned char get_decimal_point(void)
#define CJSON_VERSION_PATCH
#define can_read(buffer, size)
static cJSON_bool add_item_to_object(cJSON *const object, const char *const string, cJSON *const item, const internal_hooks *const hooks, const cJSON_bool constant_key)
Optimized string handling code, including c11-compliant "safe C library" variants.
static void minify_string(char **input, char **output)
static cJSON * cJSON_New_Item(const internal_hooks *const hooks)
static cJSON * get_array_item(const cJSON *array, size_t index)
static unsigned char utf16_literal_to_utf8(const unsigned char *const input_pointer, const unsigned char *const input_end, unsigned char **output_pointer)
static cJSON * get_object_item(const cJSON *const object, const char *const name, const cJSON_bool case_sensitive)
static unsigned parse_hex4(const unsigned char *const input)
static void skip_oneline_comment(char **input)
static void * cast_away_const(const void *string)
rpc memclnt_read_timeout returns null
cJSON *const cJSON * replacement
static parse_buffer * buffer_skip_whitespace(parse_buffer *const buffer)
description fragment has unexpected format
const char *const const double number
void *CJSON_CDECL * malloc_fn(size_t sz)
#define can_access_at_index(buffer, index)
#define CJSON_NESTING_LIMIT
static cJSON_bool print_string_ptr(const unsigned char *const input, printbuffer *const output_buffer)
static cJSON_bool print_value(const cJSON *const item, printbuffer *const output_buffer)
static int case_insensitive_strcmp(const unsigned char *string1, const unsigned char *string2)
static cJSON * create_reference(const cJSON *item, const internal_hooks *const hooks)
static cJSON_bool print_object(const cJSON *const item, printbuffer *const output_buffer)
void * malloc(size_t size)
static parse_buffer * skip_utf8_bom(parse_buffer *const buffer)
static unsigned char * cJSON_strdup(const unsigned char *string, const internal_hooks *const hooks)
sll srl srl sll sra u16x4 i
#define CJSON_VERSION_MINOR
CJSON_PUBLIC(const char *)
const char ** return_parse_end
vlib_main_t vlib_node_runtime_t * node
static cJSON_bool print_number(const cJSON *const item, printbuffer *const output_buffer)
static void update_offset(printbuffer *const buffer)
static void suffix_object(cJSON *prev, cJSON *item)
#define cannot_access_at_index(buffer, index)
void * realloc(void *p, size_t size)
const char cJSON_bool require_null_terminated
static cJSON_bool parse_value(cJSON *const item, parse_buffer *const input_buffer)
static cJSON_bool compare_double(double a, double b)
static cJSON_bool parse_number(cJSON *const item, parse_buffer *const input_buffer)
static cJSON_bool parse_object(cJSON *const item, parse_buffer *const input_buffer)
const unsigned char * json
static unsigned char * ensure(printbuffer *const p, size_t needed)
#define buffer_at_offset(buffer)
static void skip_multiline_comment(char **input)
struct internal_hooks internal_hooks
static cJSON_bool print_string(const cJSON *const item, printbuffer *const p)
const unsigned char * content
#define cJSON_StringIsConst
static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive)
static cJSON_bool print_array(const cJSON *const item, printbuffer *const output_buffer)
static cJSON_bool add_item_to_array(cJSON *array, cJSON *item)
#define cJSON_IsReference
static cJSON_bool parse_array(cJSON *const item, parse_buffer *const input_buffer)
static unsigned char * print(const cJSON *const item, cJSON_bool format, const internal_hooks *const hooks)
const cJSON *const const cJSON_bool case_sensitive
static internal_hooks global_hooks
#define CJSON_VERSION_MAJOR
const char *const const char *const raw