| 148 | #undef CJSON_TLS |
| 149 | |
| 150 | static 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 | |
| 170 | static unsigned char* cJSON_strndup(const unsigned char* str, size_t len) { |
| 171 | unsigned char *copy = NULL; |
no outgoing calls
no test coverage detected