Lines Matching full:hook
21 alloc_hook_t *hook = (alloc_hook_t *)ctx; in hook_malloc() local
22 hook->ctx = ctx; in hook_malloc()
23 hook->malloc_size = size; in hook_malloc()
24 return hook->alloc.malloc(hook->alloc.ctx, size); in hook_malloc()
30 alloc_hook_t *hook = (alloc_hook_t *)ctx; in hook_calloc() local
31 hook->ctx = ctx; in hook_calloc()
32 hook->calloc_nelem = nelem; in hook_calloc()
33 hook->calloc_elsize = elsize; in hook_calloc()
34 return hook->alloc.calloc(hook->alloc.ctx, nelem, elsize); in hook_calloc()
40 alloc_hook_t *hook = (alloc_hook_t *)ctx; in hook_realloc() local
41 hook->ctx = ctx; in hook_realloc()
42 hook->realloc_ptr = ptr; in hook_realloc()
43 hook->realloc_new_size = new_size; in hook_realloc()
44 return hook->alloc.realloc(hook->alloc.ctx, ptr, new_size); in hook_realloc()
50 alloc_hook_t *hook = (alloc_hook_t *)ctx; in hook_free() local
51 hook->ctx = ctx; in hook_free()
52 hook->free_ptr = ptr; in hook_free()
53 hook->alloc.free(hook->alloc.ctx, ptr); in hook_free()
185 alloc_hook_t hook; in test_setallocators() local
187 memset(&hook, 0, sizeof(hook)); in test_setallocators()
190 alloc.ctx = &hook; in test_setallocators()
195 PyMem_GetAllocator(domain, &hook.alloc); in test_setallocators()
200 hook.ctx = NULL; in test_setallocators()
218 if (hook.ctx != &hook) { \ in test_setallocators()
222 hook.ctx = NULL; /* reset for next check */ in test_setallocators()
229 if (hook.malloc_size != size) { in test_setallocators()
256 if (hook.realloc_ptr != ptr || hook.realloc_new_size != size2) { in test_setallocators()
274 if (hook.free_ptr != ptr2) { in test_setallocators()
302 if (hook.calloc_nelem != nelem || hook.calloc_elsize != elsize) { in test_setallocators()
307 hook.free_ptr = NULL; in test_setallocators()
321 if (hook.free_ptr != ptr) { in test_setallocators()
333 PyMem_SetAllocator(domain, &hook.alloc); in test_setallocators()