MCPcopy Create free account
hub / github.com/Tencent/TAD_Sim / cJSON_strdup

Function cJSON_strdup

common/map_sdk/transmission/src/cJSON.cpp:50–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 5

print_string_ptrFunction · 0.85
print_valueFunction · 0.85
cJSON_AddItemToObjectFunction · 0.85
cJSON_CreateStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected