| 2180 | } |
| 2181 | |
| 2182 | cJSON *cJSON_CreateString(const char *string) |
| 2183 | { |
| 2184 | cJSON *item = cJSON_New_Item(); |
| 2185 | if(item) |
| 2186 | { |
| 2187 | item->type = cJSON_String; |
| 2188 | item->valuestring = (char*)cJSON_strdup((const unsigned char*)string); |
| 2189 | if(!item->valuestring) |
| 2190 | { |
| 2191 | cJSON_Delete(item); |
| 2192 | return NULL; |
| 2193 | } |
| 2194 | } |
| 2195 | |
| 2196 | return item; |
| 2197 | } |
| 2198 | |
| 2199 | cJSON *cJSON_CreateStr(const char *string, size_t len) |
| 2200 | { |
no test coverage detected