Author: metze
Date: 2005-01-11 15:38:25 +0000 (Tue, 11 Jan 2005)
New Revision: 4689

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4689

Log:
- make talloc_report_depth() public

- add talloc_parent() to return the parent context of a pointer

these are very use full for debuging

metze

Modified:
   branches/SAMBA_4_0/source/lib/talloc/talloc.c
   branches/SAMBA_4_0/source/lib/talloc/talloc.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.c       2005-01-11 15:37:12 UTC 
(rev 4688)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.c       2005-01-11 15:38:25 UTC 
(rev 4689)
@@ -140,6 +140,12 @@
        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 @@
 /*
   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);
 

Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.h
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.h       2005-01-11 15:37:12 UTC 
(rev 4688)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.h       2005-01-11 15:38:25 UTC 
(rev 4689)
@@ -89,6 +89,8 @@
                   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);

Reply via email to