Lines Matching defs:string
40 #include <string.h>
144 /* Case insensitive string comparison, doesn't consider two NULL pointers equal though */
200 static unsigned char* cJSON_strdup(const unsigned char* string, const internal_hooks * const hooks)
205 if (string == NULL)
210 length = strlen((const char*)string) + sizeof("");
216 memcpy(copy, string, length);
280 if (!(item->type & cJSON_StringIsConst) && (item->string != NULL))
282 global_hooks.deallocate(item->string);
283 item->string = NULL;
690 /* calculate the new length of the string in a printbuffer and update the offset */
711 /* Render the number nicely from the given item into a string. */
786 /* Render the number nicely from the given item into a string. */
1023 /* not a string */
1050 goto fail; /* string ended unexpectedly */
1063 /* loop through the string literal */
1159 /* empty string */
1217 /* copy the string */
1585 /* string */
1914 /* swap valuestring and string, because we parsed the name */
1915 current_item->string = current_item->valuestring;
2007 if (!print_string_ptr((unsigned char*)current_item->string, output_buffer))
2140 while ((current_element != NULL) && (current_element->string != NULL) && (strcmp(name, current_element->string) != 0))
2147 while ((current_element != NULL) && (case_insensitive_strcmp((const unsigned char*)name, (const unsigned char*)(current_element->string)) != 0))
2153 if ((current_element == NULL) || (current_element->string == NULL)) {
2160 CJSON_PUBLIC(cJSON *) cJSON_GetObjectItem(const cJSON * const object, const char * const string)
2162 return get_object_item(object, string, false);
2165 CJSON_PUBLIC(cJSON *) cJSON_GetObjectItemCaseSensitive(const cJSON * const object, const char * const string)
2167 return get_object_item(object, string, true);
2170 CJSON_PUBLIC(cJSON_bool) cJSON_HasObjectItem(const cJSON *object, const char *string)
2172 return cJSON_GetObjectItem(object, string) ? 1 : 0;
2198 reference->string = NULL;
2250 static void* cast_away_const(const void* string)
2252 return (void*)string;
2259 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)
2264 if ((object == NULL) || (string == NULL) || (item == NULL) || (object == item))
2271 new_key = (char*)cast_away_const(string);
2276 new_key = (char*)cJSON_strdup((const unsigned char*)string, hooks);
2285 if (!(item->type & cJSON_StringIsConst) && (item->string != NULL))
2287 hooks->deallocate(item->string);
2290 item->string = new_key;
2296 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item)
2298 return add_item_to_object(object, string, item, &global_hooks, false);
2301 /* Add an item to an object with constant string as key */
2302 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item)
2304 return add_item_to_object(object, string, item, &global_hooks, true);
2317 CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item)
2319 if ((object == NULL) || (string == NULL))
2324 return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false);
2401 CJSON_PUBLIC(cJSON*) cJSON_AddStringToObject(cJSON * const object, const char * const name, const char * const string)
2403 cJSON *string_item = cJSON_CreateString(string);
2500 CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObject(cJSON *object, const char *string)
2502 cJSON *to_detach = cJSON_GetObjectItem(object, string);
2507 CJSON_PUBLIC(cJSON *) cJSON_DetachItemFromObjectCaseSensitive(cJSON *object, const char *string)
2509 cJSON *to_detach = cJSON_GetObjectItemCaseSensitive(object, string);
2514 CJSON_PUBLIC(void) cJSON_DeleteItemFromObject(cJSON *object, const char *string)
2516 cJSON_Delete(cJSON_DetachItemFromObject(object, string));
2519 CJSON_PUBLIC(void) cJSON_DeleteItemFromObjectCaseSensitive(cJSON *object, const char *string)
2521 cJSON_Delete(cJSON_DetachItemFromObjectCaseSensitive(object, string));
2618 static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive)
2620 if ((replacement == NULL) || (string == NULL))
2626 if (!(replacement->type & cJSON_StringIsConst) && (replacement->string != NULL))
2628 cJSON_free(replacement->string);
2630 replacement->string = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2631 if (replacement->string == NULL)
2638 return cJSON_ReplaceItemViaPointer(object, get_object_item(object, string, case_sensitive), replacement);
2641 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem)
2643 return replace_item_in_object(object, string, newitem, false);
2646 CJSON_PUBLIC(cJSON_bool) cJSON_ReplaceItemInObjectCaseSensitive(cJSON *object, const char *string, cJSON *newitem)
2648 return replace_item_in_object(object, string, newitem, true);
2766 CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string)
2772 item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks);
2783 CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string)
2789 item->valuestring = (char*)cast_away_const(string);
3047 if (item->string)
3049 newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks);
3050 if (!newitem->string)
3420 b_element = get_object_item(b, a_element->string, case_sensitive);
3436 a_element = get_object_item(a, b_element->string, case_sensitive);