X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftimer%2Ftimer.h;fp=ccan%2Ftimer%2Ftimer.h;h=5b193250da58308f63ec98b46d3d15496e1fe049;hp=5c40a3bbc1c9979251ad5c2b76ca6a0443c5926a;hb=23e72d4194172b52d26fed9f36c7af9b893f4649;hpb=580457bd3e4af60d5367412589d2aa1bb0289eed diff --git a/ccan/timer/timer.h b/ccan/timer/timer.h index 5c40a3bb..5b193250 100644 --- a/ccan/timer/timer.h +++ b/ccan/timer/timer.h @@ -162,6 +162,19 @@ struct timer *timers_expire(struct timers *timers, struct timemono expire); */ struct timers *timers_check(const struct timers *t, const char *abortstr); +/** + * timers_set_allocator - set malloc/free functions. + * @alloc: allocator to use + * @free: unallocator to use (@p is NULL or a return from @alloc) + * @arg: argument to pass. + * + * This replaces the underlying malloc/free with these allocators. + * Setting either one to NULL restores the default allocators. + */ +void timers_set_allocator(void *(*alloc)(size_t len, void *arg), + void (*free)(const void *p, void *arg), + void *arg); + #ifdef CCAN_TIMER_DEBUG #include