|
@@ -66,13 +66,17 @@ static void (*cJSON_free)(void *ptr) = free;
|
|
|
|
|
|
static char* cJSON_strdup(const char* str)
|
|
|
{
|
|
|
- size_t len;
|
|
|
- char* copy;
|
|
|
+ size_t len;
|
|
|
+ char* copy;
|
|
|
|
|
|
- len = strlen(str) + 1;
|
|
|
- if (!(copy = (char*)cJSON_malloc(len))) return 0;
|
|
|
- memcpy(copy,str,len);
|
|
|
- return copy;
|
|
|
+ len = strlen(str) + 1;
|
|
|
+ if (!(copy = (char*)cJSON_malloc(len)))
|
|
|
+ {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ memcpy(copy, str, len);
|
|
|
+
|
|
|
+ return copy;
|
|
|
}
|
|
|
|
|
|
void cJSON_InitHooks(cJSON_Hooks* hooks)
|