Similar to zfree, '*usable' is set to the usable size being freed. */
| 312 | |
| 313 | /* Similar to zfree, '*usable' is set to the usable size being freed. */ |
| 314 | void zfree_usable(void *ptr, size_t *usable) { |
| 315 | #ifndef HAVE_MALLOC_SIZE |
| 316 | void *realptr; |
| 317 | size_t oldsize; |
| 318 | #endif |
| 319 | |
| 320 | if (ptr == NULL) return; |
| 321 | #ifdef HAVE_MALLOC_SIZE |
| 322 | update_zmalloc_stat_free(*usable = zmalloc_size(ptr)); |
| 323 | free(ptr); |
| 324 | #else |
| 325 | realptr = (char*)ptr-PREFIX_SIZE; |
| 326 | *usable = oldsize = *((size_t*)realptr); |
| 327 | update_zmalloc_stat_free(oldsize+PREFIX_SIZE); |
| 328 | free(realptr); |
| 329 | #endif |
| 330 | } |
| 331 | |
| 332 | char *zstrdup(const char *s) { |
| 333 | size_t l = strlen(s)+1; |
nothing calls this directly
no test coverage detected