MCPcopy Index your code
hub / github.com/DaveGamble/cJSON / cJSONUtils_strdup

Function cJSONUtils_strdup

cJSON_Utils.c:66–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64#define false ((cJSON_bool)0)
65
66static unsigned char* cJSONUtils_strdup(const unsigned char* const string)
67{
68 size_t length = 0;
69 unsigned char *copy = NULL;
70
71 length = strlen((const char*)string) + sizeof("");
72 copy = (unsigned char*) cJSON_malloc(length);
73 if (copy == NULL)
74 {
75 return NULL;
76 }
77 memcpy(copy, string, length);
78
79 return copy;
80}
81
82/* string comparison which doesn't consider NULL pointers equal */
83static int compare_strings(const unsigned char *string1, const unsigned char *string2, const cJSON_bool case_sensitive)

Callers 3

detach_pathFunction · 0.85
apply_patchFunction · 0.85

Calls 1

cJSON_mallocFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…