X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftimer%2Ftimer.h;h=d6e81e8cacbf2dfe94f3d73468e8a70aa12caa7c;hb=HEAD;hp=5c40a3bbc1c9979251ad5c2b76ca6a0443c5926a;hpb=4ba104904176bc059167757c10d461703b6b06dc;p=ccan diff --git a/ccan/timer/timer.h b/ccan/timer/timer.h index 5c40a3bb..2eb33c91 100644 --- a/ccan/timer/timer.h +++ b/ccan/timer/timer.h @@ -162,6 +162,17 @@ 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) + * + * This replaces the underlying malloc/free with these allocators. + * Setting either one to NULL restores the default allocators. + */ +void timers_set_allocator(void *(*alloc)(struct timers *, size_t len), + void (*free)(struct timers *, void *p)); + #ifdef CCAN_TIMER_DEBUG #include