MCPcopy Index your code
hub / github.com/armink/struct2json / cJSON_strdup

Function cJSON_strdup

struct2json/src/cJSON.c:49–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47static void (*cJSON_free)(void *ptr) = free;
48
49static char* cJSON_strdup(const char* str)
50{
51 size_t len;
52 char* copy;
53
54 len = strlen(str) + 1;
55 if (!(copy = (char*)cJSON_malloc(len))) return 0;
56 memcpy(copy,str,len);
57 return copy;
58}
59
60void cJSON_InitHooks(cJSON_Hooks* hooks)
61{

Callers 5

print_valueFunction · 0.85
cJSON_AddItemToObjectFunction · 0.85
cJSON_CreateStringFunction · 0.85
cJSON_DuplicateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected