• Home
  • Raw
  • Download

Lines Matching refs:item

181 CJSON_PUBLIC(void) cJSON_Delete(cJSON *item)  in cJSON_Delete()  argument
184 while (item != NULL) in cJSON_Delete()
186 next = item->next; in cJSON_Delete()
187 if (!(item->type & cJSON_IsReference) && (item->child != NULL)) in cJSON_Delete()
189 cJSON_Delete(item->child); in cJSON_Delete()
191 if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL)) in cJSON_Delete()
193 global_hooks.deallocate(item->valuestring); in cJSON_Delete()
195 if (!(item->type & cJSON_StringIsConst) && (item->string != NULL)) in cJSON_Delete()
197 global_hooks.deallocate(item->string); in cJSON_Delete()
199 global_hooks.deallocate(item); in cJSON_Delete()
200 item = next; in cJSON_Delete()
230 static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_buffer) in parse_number() argument
284 item->valuedouble = number; in parse_number()
289 item->valueint = LLONG_MAX; in parse_number()
293 item->valueint = LLONG_MIN; in parse_number()
297 item->valueint = (int64_t)number; in parse_number()
300 item->type = cJSON_Number; in parse_number()
430 static cJSON_bool print_number(const cJSON * const item, printbuffer * const output_buffer) in print_number() argument
433 double d = item->valuedouble; in print_number()
654 static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_buffer) in parse_string() argument
760 item->type = cJSON_String; in parse_string()
761 item->valuestring = (char*)output; in parse_string()
905 static cJSON_bool print_string(const cJSON * const item, printbuffer * const p) in print_string() argument
907 return print_string_ptr((unsigned char*)item->valuestring, p); in print_string()
911 static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer);
912 static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer);
913 static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer);
914 static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer);
915 static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer);
916 static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer);
943 cJSON *item = NULL; in cJSON_ParseWithOpts() local
959 item = cJSON_New_Item(&global_hooks); in cJSON_ParseWithOpts()
960 if (item == NULL) /* memory fail */ in cJSON_ParseWithOpts()
965 if (!parse_value(item, buffer_skip_whitespace(&buffer))) in cJSON_ParseWithOpts()
985 return item; in cJSON_ParseWithOpts()
988 if (item != NULL) in cJSON_ParseWithOpts()
990 cJSON_Delete(item); in cJSON_ParseWithOpts()
1029 static unsigned char *print(const cJSON * const item, cJSON_bool format, const internal_hooks * con… in print() argument
1046 if (!print_value(item, buffer)) in print()
1092 CJSON_PUBLIC(char *) cJSON_Print(const cJSON *item) in cJSON_Print() argument
1094 return (char*)print(item, true, &global_hooks); in cJSON_Print()
1097 CJSON_PUBLIC(char *) cJSON_PrintUnformatted(const cJSON *item) in cJSON_PrintUnformatted() argument
1099 return (char*)print(item, false, &global_hooks); in cJSON_PrintUnformatted()
1102 CJSON_PUBLIC(char *) cJSON_PrintBuffered(const cJSON *item, int prebuffer, cJSON_bool fmt) in cJSON_PrintBuffered() argument
1123 if (!print_value(item, &p)) in cJSON_PrintBuffered()
1131 CJSON_PUBLIC(cJSON_bool) cJSON_PrintPreallocated(cJSON *item, char *buf, const int len, const cJSON… in cJSON_PrintPreallocated() argument
1147 return print_value(item, &p); in cJSON_PrintPreallocated()
1151 static cJSON_bool parse_value(cJSON * const item, parse_buffer * const input_buffer) in parse_value() argument
1162 item->type = cJSON_NULL; in parse_value()
1169 item->type = cJSON_False; in parse_value()
1176 item->type = cJSON_True; in parse_value()
1177 item->valueint = 1; in parse_value()
1184 return parse_string(item, input_buffer); in parse_value()
1189 return parse_number(item, input_buffer); in parse_value()
1194 return parse_array(item, input_buffer); in parse_value()
1199 return parse_object(item, input_buffer); in parse_value()
1207 static cJSON_bool print_value(const cJSON * const item, printbuffer * const output_buffer) in print_value() argument
1211 if ((item == NULL) || (output_buffer == NULL)) in print_value()
1216 switch ((item->type) & 0xFF) in print_value()
1246 return print_number(item, output_buffer); in print_value()
1251 if (item->valuestring == NULL) in print_value()
1260 raw_length = strlen(item->valuestring) + sizeof(""); in print_value()
1266 memcpy(output, item->valuestring, raw_length); in print_value()
1271 return print_string(item, output_buffer); in print_value()
1274 return print_array(item, output_buffer); in print_value()
1277 return print_object(item, output_buffer); in print_value()
1285 static cJSON_bool parse_array(cJSON * const item, parse_buffer * const input_buffer) in parse_array() argument
1362 item->type = cJSON_Array; in parse_array()
1363 item->child = head; in parse_array()
1379 static cJSON_bool print_array(const cJSON * const item, printbuffer * const output_buffer) in print_array() argument
1383 cJSON *current_element = item->child; in print_array()
1441 static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer) in parse_object() argument
1534 item->type = cJSON_Object; in parse_object()
1535 item->child = head; in parse_object()
1550 static cJSON_bool print_object(const cJSON * const item, printbuffer * const output_buffer) in print_object() argument
1554 cJSON *current_item = item->child; in print_object()
1752 static void suffix_object(cJSON *prev, cJSON *item) in suffix_object() argument
1754 prev->next = item; in suffix_object()
1755 item->prev = prev; in suffix_object()
1759 static cJSON *create_reference(const cJSON *item, const internal_hooks * const hooks) in create_reference() argument
1766 memcpy(ref, item, sizeof(cJSON)); in create_reference()
1774 CJSON_PUBLIC(void) cJSON_AddItemToArray(cJSON *array, cJSON *item) in cJSON_AddItemToArray() argument
1778 if ((item == NULL) || (array == NULL)) in cJSON_AddItemToArray()
1788 array->child = item; in cJSON_AddItemToArray()
1797 suffix_object(child, item); in cJSON_AddItemToArray()
1801 CJSON_PUBLIC(void) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item) in cJSON_AddItemToObject() argument
1804 …_AddItemToObjectCS(object, (char*)cJSON_strdup((const unsigned char*)string, &global_hooks), item); in cJSON_AddItemToObject()
1806 item->type &= ~cJSON_StringIsConst; in cJSON_AddItemToObject()
1817 CJSON_PUBLIC(void) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) in cJSON_AddItemToObjectCS() argument
1819 if (!item) in cJSON_AddItemToObjectCS()
1823 if (!(item->type & cJSON_StringIsConst) && item->string) in cJSON_AddItemToObjectCS()
1825 global_hooks.deallocate(item->string); in cJSON_AddItemToObjectCS()
1827 item->string = (char*)string; in cJSON_AddItemToObjectCS()
1828 item->type |= cJSON_StringIsConst; in cJSON_AddItemToObjectCS()
1829 cJSON_AddItemToArray(object, item); in cJSON_AddItemToObjectCS()
1835 CJSON_PUBLIC(void) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) in cJSON_AddItemReferenceToArray() argument
1837 cJSON_AddItemToArray(array, create_reference(item, &global_hooks)); in cJSON_AddItemReferenceToArray()
1840 CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) in cJSON_AddItemReferenceToObject() argument
1842 cJSON_AddItemToObject(object, string, create_reference(item, &global_hooks)); in cJSON_AddItemReferenceToObject()
1845 CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item) in cJSON_DetachItemViaPointer() argument
1847 if ((parent == NULL) || (item == NULL)) in cJSON_DetachItemViaPointer()
1852 if (item->prev != NULL) in cJSON_DetachItemViaPointer()
1855 item->prev->next = item->next; in cJSON_DetachItemViaPointer()
1857 if (item->next != NULL) in cJSON_DetachItemViaPointer()
1860 item->next->prev = item->prev; in cJSON_DetachItemViaPointer()
1863 if (item == parent->child) in cJSON_DetachItemViaPointer()
1866 parent->child = item->next; in cJSON_DetachItemViaPointer()
1869 item->prev = NULL; in cJSON_DetachItemViaPointer()
1870 item->next = NULL; in cJSON_DetachItemViaPointer()
1872 return item; in cJSON_DetachItemViaPointer()
1944 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemViaPointer(cJSON * const parent, cJSON * const item, cJSO… in cJSON_ReplaceItemViaPointer() argument
1951 if (replacement == item) in cJSON_ReplaceItemViaPointer()
1956 replacement->next = item->next; in cJSON_ReplaceItemViaPointer()
1957 replacement->prev = item->prev; in cJSON_ReplaceItemViaPointer()
1967 if (parent->child == item) in cJSON_ReplaceItemViaPointer()
1972 item->next = NULL; in cJSON_ReplaceItemViaPointer()
1973 item->prev = NULL; in cJSON_ReplaceItemViaPointer()
1974 cJSON_Delete(item); in cJSON_ReplaceItemViaPointer()
2002 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateNull() local
2003 if(item) in cJSON_CreateNull()
2005 item->type = cJSON_NULL; in cJSON_CreateNull()
2008 return item; in cJSON_CreateNull()
2013 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateTrue() local
2014 if(item) in cJSON_CreateTrue()
2016 item->type = cJSON_True; in cJSON_CreateTrue()
2019 return item; in cJSON_CreateTrue()
2024 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateFalse() local
2025 if(item) in cJSON_CreateFalse()
2027 item->type = cJSON_False; in cJSON_CreateFalse()
2030 return item; in cJSON_CreateFalse()
2035 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateBool() local
2036 if(item) in cJSON_CreateBool()
2038 item->type = b ? cJSON_True : cJSON_False; in cJSON_CreateBool()
2041 return item; in cJSON_CreateBool()
2046 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateNumber() local
2047 if(item) in cJSON_CreateNumber()
2049 item->type = cJSON_Number; in cJSON_CreateNumber()
2050 item->valuedouble = num; in cJSON_CreateNumber()
2055 item->valueint = LLONG_MAX; in cJSON_CreateNumber()
2059 item->valueint = LLONG_MIN; in cJSON_CreateNumber()
2063 item->valueint = (int64_t)num; in cJSON_CreateNumber()
2067 return item; in cJSON_CreateNumber()
2072 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateString() local
2073 if(item) in cJSON_CreateString()
2075 item->type = cJSON_String; in cJSON_CreateString()
2076 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); in cJSON_CreateString()
2077 if(!item->valuestring) in cJSON_CreateString()
2079 cJSON_Delete(item); in cJSON_CreateString()
2084 return item; in cJSON_CreateString()
2089 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateRaw() local
2090 if(item) in cJSON_CreateRaw()
2092 item->type = cJSON_Raw; in cJSON_CreateRaw()
2093 item->valuestring = (char*)cJSON_strdup((const unsigned char*)raw, &global_hooks); in cJSON_CreateRaw()
2094 if(!item->valuestring) in cJSON_CreateRaw()
2096 cJSON_Delete(item); in cJSON_CreateRaw()
2101 return item; in cJSON_CreateRaw()
2106 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateArray() local
2107 if(item) in cJSON_CreateArray()
2109 item->type=cJSON_Array; in cJSON_CreateArray()
2112 return item; in cJSON_CreateArray()
2117 cJSON *item = cJSON_New_Item(&global_hooks); in cJSON_CreateObject() local
2118 if (item) in cJSON_CreateObject()
2120 item->type = cJSON_Object; in cJSON_CreateObject()
2123 return item; in cJSON_CreateObject()
2271 CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) in cJSON_Duplicate() argument
2279 if (!item) in cJSON_Duplicate()
2290 newitem->type = item->type & (~cJSON_IsReference); in cJSON_Duplicate()
2291 newitem->valueint = item->valueint; in cJSON_Duplicate()
2292 newitem->valuedouble = item->valuedouble; in cJSON_Duplicate()
2293 if (item->valuestring) in cJSON_Duplicate()
2295 … newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); in cJSON_Duplicate()
2301 if (item->string) in cJSON_Duplicate()
2303 …newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned … in cJSON_Duplicate()
2315 child = item->child; in cJSON_Duplicate()
2414 CJSON_PUBLIC(cJSON_bool) cJSON_IsInvalid(const cJSON * const item) in cJSON_IsInvalid() argument
2416 if (item == NULL) in cJSON_IsInvalid()
2421 return (item->type & 0xFF) == cJSON_Invalid; in cJSON_IsInvalid()
2424 CJSON_PUBLIC(cJSON_bool) cJSON_IsFalse(const cJSON * const item) in cJSON_IsFalse() argument
2426 if (item == NULL) in cJSON_IsFalse()
2431 return (item->type & 0xFF) == cJSON_False; in cJSON_IsFalse()
2434 CJSON_PUBLIC(cJSON_bool) cJSON_IsTrue(const cJSON * const item) in cJSON_IsTrue() argument
2436 if (item == NULL) in cJSON_IsTrue()
2441 return (item->type & 0xff) == cJSON_True; in cJSON_IsTrue()
2445 CJSON_PUBLIC(cJSON_bool) cJSON_IsBool(const cJSON * const item) in cJSON_IsBool() argument
2447 if (item == NULL) in cJSON_IsBool()
2452 return (item->type & (cJSON_True | cJSON_False)) != 0; in cJSON_IsBool()
2454 CJSON_PUBLIC(cJSON_bool) cJSON_IsNull(const cJSON * const item) in cJSON_IsNull() argument
2456 if (item == NULL) in cJSON_IsNull()
2461 return (item->type & 0xFF) == cJSON_NULL; in cJSON_IsNull()
2464 CJSON_PUBLIC(cJSON_bool) cJSON_IsNumber(const cJSON * const item) in cJSON_IsNumber() argument
2466 if (item == NULL) in cJSON_IsNumber()
2471 return (item->type & 0xFF) == cJSON_Number; in cJSON_IsNumber()
2474 CJSON_PUBLIC(cJSON_bool) cJSON_IsString(const cJSON * const item) in cJSON_IsString() argument
2476 if (item == NULL) in cJSON_IsString()
2481 return (item->type & 0xFF) == cJSON_String; in cJSON_IsString()
2484 CJSON_PUBLIC(cJSON_bool) cJSON_IsArray(const cJSON * const item) in cJSON_IsArray() argument
2486 if (item == NULL) in cJSON_IsArray()
2491 return (item->type & 0xFF) == cJSON_Array; in cJSON_IsArray()
2494 CJSON_PUBLIC(cJSON_bool) cJSON_IsObject(const cJSON * const item) in cJSON_IsObject() argument
2496 if (item == NULL) in cJSON_IsObject()
2501 return (item->type & 0xFF) == cJSON_Object; in cJSON_IsObject()
2504 CJSON_PUBLIC(cJSON_bool) cJSON_IsRaw(const cJSON * const item) in cJSON_IsRaw() argument
2506 if (item == NULL) in cJSON_IsRaw()
2511 return (item->type & 0xFF) == cJSON_Raw; in cJSON_IsRaw()