| 2444 | } |
| 2445 | |
| 2446 | CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) |
| 2447 | { |
| 2448 | cJSON *item = cJSON_New_Item(&global_hooks); |
| 2449 | if(item) |
| 2450 | { |
| 2451 | item->type = cJSON_String; |
| 2452 | item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); |
| 2453 | if(!item->valuestring) |
| 2454 | { |
| 2455 | cJSON_Delete(item); |
| 2456 | return NULL; |
| 2457 | } |
| 2458 | } |
| 2459 | |
| 2460 | return item; |
| 2461 | } |
| 2462 | |
| 2463 | CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) |
| 2464 | { |
no test coverage detected