mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
reformatting: cJSON_CreateString
This commit is contained in:
parent
3f9f4970b4
commit
034003ce2b
18
cJSON.c
18
cJSON.c
@ -1899,7 +1899,23 @@ cJSON *cJSON_CreateNumber(double num)
|
||||
return item;
|
||||
}
|
||||
|
||||
cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);if(!item->valuestring){cJSON_Delete(item);return 0;}}return item;}
|
||||
cJSON *cJSON_CreateString(const char *string)
|
||||
{
|
||||
cJSON *item = cJSON_New_Item();
|
||||
if(item)
|
||||
{
|
||||
item->type = cJSON_String;
|
||||
item->valuestring = cJSON_strdup(string);
|
||||
if(!item->valuestring)
|
||||
{
|
||||
cJSON_Delete(item);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;}
|
||||
cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user