| 293 | #endif |
| 294 | |
| 295 | void zfree(const void *ptr) { |
| 296 | #ifndef HAVE_MALLOC_SIZE |
| 297 | void *realptr; |
| 298 | size_t oldsize; |
| 299 | #endif |
| 300 | |
| 301 | if (ptr == NULL) return; |
| 302 | #ifdef HAVE_MALLOC_SIZE |
| 303 | update_zmalloc_stat_free(zmalloc_size((void*)ptr)); |
| 304 | free((void*)ptr); |
| 305 | #else |
| 306 | realptr = (char*)ptr-PREFIX_SIZE; |
| 307 | oldsize = *((size_t*)realptr); |
| 308 | update_zmalloc_stat_free(oldsize+PREFIX_SIZE); |
| 309 | free(realptr); |
| 310 | #endif |
| 311 | } |
| 312 | |
| 313 | /* Similar to zfree, '*usable' is set to the usable size being freed. */ |
| 314 | void zfree_usable(void *ptr, size_t *usable) { |
no test coverage detected