svn commit: samba r6075 - in branches/SAMBA_4_0/source/lib/talloc: .
tridge at samba.org
tridge at samba.org
Sat Mar 26 10:47:44 GMT 2005
Author: tridge
Date: 2005-03-26 10:47:44 +0000 (Sat, 26 Mar 2005)
New Revision: 6075
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6075
Log:
added talloc_enable_null_tracking() (asked for by lifeless)
Modified:
branches/SAMBA_4_0/source/lib/talloc/talloc.c
branches/SAMBA_4_0/source/lib/talloc/talloc.h
branches/SAMBA_4_0/source/lib/talloc/talloc_guide.txt
Changeset:
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.c 2005-03-26 10:22:02 UTC (rev 6074)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.c 2005-03-26 10:47:44 UTC (rev 6075)
@@ -812,11 +812,21 @@
}
/*
+ enable tracking of the NULL context
+*/
+void talloc_enable_null_tracking(void)
+{
+ if (null_context == NULL) {
+ null_context = talloc_named_const(NULL, 0, "null_context");
+ }
+}
+
+/*
enable leak reporting on exit
*/
void talloc_enable_leak_report(void)
{
- null_context = talloc_named_const(NULL, 0, "null_context");
+ talloc_enable_null_tracking();
atexit(talloc_report_null);
}
@@ -825,7 +835,7 @@
*/
void talloc_enable_leak_report_full(void)
{
- null_context = talloc_named_const(NULL, 0, "null_context");
+ talloc_enable_null_tracking();
atexit(talloc_report_null_full);
}
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.h
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc.h 2005-03-26 10:22:02 UTC (rev 6074)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc.h 2005-03-26 10:47:44 UTC (rev 6075)
@@ -110,6 +110,7 @@
off_t talloc_total_blocks(const void *ptr);
void talloc_report_full(const void *ptr, FILE *f);
void talloc_report(const void *ptr, FILE *f);
+void talloc_enable_null_tracking(void);
void talloc_enable_leak_report(void);
void talloc_enable_leak_report_full(void);
void *_talloc_zero(const void *ctx, size_t size, const char *name);
Modified: branches/SAMBA_4_0/source/lib/talloc/talloc_guide.txt
===================================================================
--- branches/SAMBA_4_0/source/lib/talloc/talloc_guide.txt 2005-03-26 10:22:02 UTC (rev 6074)
+++ branches/SAMBA_4_0/source/lib/talloc/talloc_guide.txt 2005-03-26 10:47:44 UTC (rev 6075)
@@ -409,6 +409,14 @@
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+void talloc_enable_null_tracking(void);
+
+This enables tracking of the NULL memory context without enabling leak
+reporting on exit. Useful for when you want to do your own leak
+reporting call via talloc_report_null_full();
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
(type *)talloc_zero(const void *ctx, type);
The talloc_zero() macro is equivalent to:
More information about the samba-cvs
mailing list