From 90d65c2e85c8042391b8219eeaedd780e6eb3c7c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 11 Jan 2005 15:38:25 +0000 Subject: [PATCH] r4689: - make talloc_report_depth() public - add talloc_parent() to return the parent context of a pointer these are very use full for debuging metze (This used to be commit 9b9501bc03ef8d4b53049f6b3531d06ed7ef7f89) --- source4/lib/talloc/talloc.c | 8 +++++++- source4/lib/talloc/talloc.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source4/lib/talloc/talloc.c b/source4/lib/talloc/talloc.c index 6d11cb00e91..4c8cc310280 100644 --- a/source4/lib/talloc/talloc.c +++ b/source4/lib/talloc/talloc.c @@ -140,6 +140,12 @@ static struct talloc_chunk *talloc_parent_chunk(const void *ptr) return tc->parent; } +void *talloc_parent(const void *ptr) +{ + struct talloc_chunk *tc = talloc_parent_chunk(ptr); + return (void *)(tc+1); +} + /* Allocate a bit of memory as a child of an existing pointer */ @@ -695,7 +701,7 @@ static int talloc_reference_count(const void *ptr) /* report on memory usage by all children of a pointer, giving a full tree view */ -static void talloc_report_depth(const void *ptr, FILE *f, int depth) +void talloc_report_depth(const void *ptr, FILE *f, int depth) { struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr); diff --git a/source4/lib/talloc/talloc.h b/source4/lib/talloc/talloc.h index cf03ce59521..3483bb9e710 100644 --- a/source4/lib/talloc/talloc.h +++ b/source4/lib/talloc/talloc.h @@ -89,6 +89,8 @@ void *talloc_named(const void *context, size_t size, const char *fmt, ...) PRINTF_ATTRIBUTE(3,4); void *talloc_named_const(const void *context, size_t size, const char *name); const char *talloc_get_name(const void *ptr); +void talloc_report_depth(const void *ptr, FILE *f, int depth); +void *talloc_parent(const void *ptr); void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2); int talloc_free(void *ptr); void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name);