From 8f09abffd3d58f419a55159dadc7ae099b59595f Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 7 May 2005 16:04:37 +0000 Subject: r6646: keep samba3 talloc inline with samba4 one (This used to be commit 4deebbbe50932792621114bf1e74b0c994bda7be) --- source3/include/talloc.h | 1 + source3/lib/talloc.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/source3/include/talloc.h b/source3/include/talloc.h index a4f19d3587..738506e323 100644 --- a/source3/include/talloc.h +++ b/source3/include/talloc.h @@ -122,6 +122,7 @@ void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name); void *talloc_realloc_fn(const void *context, void *ptr, size_t size); void *talloc_autofree_context(void); +size_t talloc_get_size(const void *ctx); #endif diff --git a/source3/lib/talloc.c b/source3/lib/talloc.c index da3a2300b0..4aeac5fef2 100644 --- a/source3/lib/talloc.c +++ b/source3/lib/talloc.c @@ -1081,4 +1081,13 @@ void *talloc_autofree_context(void) return cleanup_context; } +size_t talloc_get_size(const void *context) { + struct talloc_chunk *tc; + + if (context == NULL) + return 0; + tc = talloc_chunk_from_ptr(context); + + return tc->size; +} -- cgit