MCPcopy Create free account
hub / github.com/Netis/cloud-probe / cJSONUtils_strdup

Function cJSONUtils_strdup

cpworker/src/cJSON/cJSON_Utils.c:65–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63#define false ((cJSON_bool)0)
64
65static unsigned char *cJSONUtils_strdup(const unsigned char *const string)
66{
67 size_t length = 0;
68 unsigned char *copy = NULL;
69
70 length = strlen((const char *)string) + sizeof("");
71 copy = (unsigned char *)cJSON_malloc(length);
72 if (copy == NULL)
73 {
74 return NULL;
75 }
76 memcpy(copy, string, length);
77
78 return copy;
79}
80
81/* string comparison which doesn't consider NULL pointers equal */
82static 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