* return pointer p to cache, nelem is number of elements of the cache bucket * size (1 or sizeof(npy_intp)) of the block pointed too */
| 127 | * size (1 or sizeof(npy_intp)) of the block pointed too |
| 128 | */ |
| 129 | static inline void |
| 130 | _npy_free_cache(void * p, npy_uintp nelem, npy_uint msz, |
| 131 | cache_bucket * cache, void (*dealloc)(void *)) |
| 132 | { |
| 133 | assert(PyGILState_Check()); |
| 134 | if (p != NULL && nelem < msz) { |
| 135 | if (cache[nelem].available < NCACHE) { |
| 136 | cache[nelem].ptrs[cache[nelem].available++] = p; |
| 137 | return; |
| 138 | } |
| 139 | } |
| 140 | dealloc(p); |
| 141 | } |
| 142 | |
| 143 | |
| 144 | /* |
no outgoing calls
no test coverage detected