X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftalloc%2Ftalloc.h;h=5263b9fed269261f833b2e9d55765a7242ca964b;hp=d27c68922c9c8f0d98a0b5fe76d3ea4b8093d3fb;hb=c520b4adbbfba5a663b94e71216b90eddd0bf877;hpb=1e962ba9b5808dafc0be9cc562b25e3ae068ca5d;ds=sidebyside diff --git a/ccan/talloc/talloc.h b/ccan/talloc/talloc.h index d27c6892..5263b9fe 100644 --- a/ccan/talloc/talloc.h +++ b/ccan/talloc/talloc.h @@ -957,6 +957,19 @@ size_t talloc_get_size(const void *ctx); */ void *talloc_find_parent_byname(const void *ctx, const char *name); +/** + * talloc_set_allocator - set the allocations function(s) for talloc. + * @malloc: the malloc function + * @free: the free function + * @realloc: the realloc function + * + * Instead of using the standard malloc, free and realloc, talloc will use + * these replacements. @realloc will never be called with size 0 or ptr NULL. + */ +void talloc_set_allocator(void *(*malloc)(size_t size), + void (*free)(void *ptr), + void *(*realloc)(void *ptr, size_t size)); + /** * talloc_add_external - create an externally allocated node * @ctx: the parent