diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-21 00:03:42 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-09-21 00:03:42 +0200 |
commit | 257ea8f96f4bb56edacdeba37e5fc16bb6ac2bc3 (patch) | |
tree | 7130ff9e967ac35861742427b8120ee6025268d1 /lib/talloc/talloc.c | |
parent | c1527612b95cb7bc5bee7ebc34ab87013ab88b8a (diff) | |
parent | ae56b0f2f96cea7a77b0a19c0d16d94ad971fb3f (diff) | |
download | samba-257ea8f96f4bb56edacdeba37e5fc16bb6ac2bc3.tar.gz samba-257ea8f96f4bb56edacdeba37e5fc16bb6ac2bc3.tar.bz2 samba-257ea8f96f4bb56edacdeba37e5fc16bb6ac2bc3.zip |
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'lib/talloc/talloc.c')
-rw-r--r-- | lib/talloc/talloc.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index f103a9b941..7beda4b0f5 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -1477,10 +1477,37 @@ void talloc_enable_null_tracking(void) } /* + enable tracking of the NULL context, not moving the autofree context + into the NULL context. This is needed for the talloc testsuite +*/ +void talloc_enable_null_tracking_no_autofree(void) +{ + if (null_context == NULL) { + null_context = _talloc_named_const(NULL, 0, "null_context"); + } +} + +/* disable tracking of the NULL context */ void talloc_disable_null_tracking(void) { + if (null_context != NULL) { + /* we have to move any children onto the real NULL + context */ + struct talloc_chunk *tc, *tc2; + tc = talloc_chunk_from_ptr(null_context); + for (tc2 = tc->child; tc2; tc2=tc2->next) { + if (tc2->parent == tc) tc2->parent = NULL; + if (tc2->prev == tc) tc2->prev = NULL; + } + for (tc2 = tc->next; tc2; tc2=tc2->next) { + if (tc2->parent == tc) tc2->parent = NULL; + if (tc2->prev == tc) tc2->prev = NULL; + } + tc->child = NULL; + tc->next = NULL; + } talloc_free(null_context); null_context = NULL; } |