| 2460 | } |
| 2461 | |
| 2462 | CJSON_PUBLIC(cJSON *) cJSON_CreateString(const char *string) |
| 2463 | { |
| 2464 | cJSON *item = cJSON_New_Item(&global_hooks); |
| 2465 | if(item) |
| 2466 | { |
| 2467 | item->type = cJSON_String; |
| 2468 | item->valuestring = (char*)cJSON_strdup((const unsigned char*)string, &global_hooks); |
| 2469 | if(!item->valuestring) |
| 2470 | { |
| 2471 | cJSON_Delete(item); |
| 2472 | return NULL; |
| 2473 | } |
| 2474 | } |
| 2475 | |
| 2476 | return item; |
| 2477 | } |
| 2478 | |
| 2479 | CJSON_PUBLIC(cJSON *) cJSON_CreateStringReference(const char *string) |
| 2480 | { |
no test coverage detected