| 1 | #ifndef STORE_ALLOC_H | ||
| 2 | #define STORE_ALLOC_H | ||
| 3 | |||
| 4 | /* Every block this dist allocates for itself, counted, so a test can say | ||
| 5 | * that nothing was left behind. What HAMT allocates on its behalf is HAMT's | ||
| 6 | * to count. One number for the process and nothing locks it: it means | ||
| 7 | * something only while one thread is using the library, which is when the | ||
| 8 | * tests read it. */ | ||
| 9 | static long store_live_blocks = 0; | ||
| 10 | |||
| 11 | 2376 | static void *store_alloc(pTHX_ size_t bytes) { | |
| 12 | void *p; | ||
| 13 | 2376 | Newxz(p, bytes, char); | |
| 14 | 2376 | store_live_blocks++; | |
| 15 | 2376 | return p; | |
| 16 | } | ||
| 17 | |||
| 18 | 2376 | static void store_free(pTHX_ void *p) { | |
| 19 | 2376 | store_live_blocks--; | |
| 20 | 2376 | Safefree(p); | |
| 21 | 2376 | } | |
| 22 | |||
| 23 | #endif |