summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-01-10 09:53:51 +0100
committerVolker Lendecke <vl@samba.org>2008-01-10 09:54:06 +0100
commit7579e08599dd2139617da5639144700774233c08 (patch)
tree2fd1da4e28a0ba6e703bb21f0dfbe055e1d1da70 /source3/lib
parent980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8 (diff)
downloadsamba-7579e08599dd2139617da5639144700774233c08.tar.gz
samba-7579e08599dd2139617da5639144700774233c08.tar.bz2
samba-7579e08599dd2139617da5639144700774233c08.zip
Form a proper hierarchy in talloc_stack
This way talloc_stackframe() can benefit from a pool put on the stack further up. No need to remove talloc_stackframe(). (This used to be commit be6fe381168321ae62e079cd977cbef675c532d4)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/talloc_stack.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/lib/talloc_stack.c b/source3/lib/talloc_stack.c
index 08ef2281ea..2722fb9676 100644
--- a/source3/lib/talloc_stack.c
+++ b/source3/lib/talloc_stack.c
@@ -66,7 +66,7 @@ static int talloc_pop(TALLOC_CTX *frame)
static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize)
{
- TALLOC_CTX **tmp, *top;
+ TALLOC_CTX **tmp, *top, *parent;
if (talloc_stack_arraysize < talloc_stacksize + 1) {
tmp = TALLOC_REALLOC_ARRAY(NULL, talloc_stack, TALLOC_CTX *,
@@ -78,10 +78,17 @@ static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize)
talloc_stack_arraysize = talloc_stacksize + 1;
}
+ if (talloc_stacksize == 0) {
+ parent = talloc_stack;
+ }
+ else {
+ parent = talloc_stack[talloc_stacksize-1];
+ }
+
if (poolsize) {
- top = talloc_pool(talloc_stack, poolsize);
+ top = talloc_pool(parent, poolsize);
} else {
- top = talloc_new(talloc_stack);
+ top = talloc_new(parent);
}
if (top == NULL) {