MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / cJSON_strdup

Function cJSON_strdup

lib/cJSON.c:150–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148#undef CJSON_TLS
149
150static unsigned char* cJSON_strdup(const unsigned char* str)
151{
152 size_t len = 0;
153 unsigned char *copy = NULL;
154
155 if (str == NULL)
156 {
157 return NULL;
158 }
159
160 len = strlen((const char*)str) + 1;
161 if (!(copy = (unsigned char*)cJSON_malloc(len)))
162 {
163 return NULL;
164 }
165 memcpy(copy, str, len);
166
167 return copy;
168}
169
170static unsigned char* cJSON_strndup(const unsigned char* str, size_t len) {
171 unsigned char *copy = NULL;

Callers 6

print_valueFunction · 0.70
cJSON_AddItemToObjectFunction · 0.70
cJSON_CreateStringFunction · 0.70
cJSON_CreateRawFunction · 0.70
cJSON_DuplicateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected