| 168 | } |
| 169 | |
| 170 | static unsigned char* cJSON_strndup(const unsigned char* str, size_t len) { |
| 171 | unsigned char *copy = NULL; |
| 172 | |
| 173 | if (str == NULL) |
| 174 | { |
| 175 | return NULL; |
| 176 | } |
| 177 | |
| 178 | if (!(copy = (unsigned char*)cJSON_malloc(len + 1))) |
| 179 | { |
| 180 | return NULL; |
| 181 | } |
| 182 | memcpy(copy, str, len); |
| 183 | copy[len] = 0; |
| 184 | |
| 185 | return copy; |
| 186 | } |
| 187 | |
| 188 | void cJSON_InitHooks(cJSON_Hooks* hooks) |
| 189 | { |
no outgoing calls
no test coverage detected