From 5df6018114ca54d97a7d67d554a090a56270d45e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 9 Jan 2008 17:07:58 -0800 Subject: Add the calls to make use of talloc_pools in a talloc_stackframe. Jeremy. (This used to be commit d27e6c0548d21394f6399d3b737d175ffed8420d) --- source3/include/talloc_stack.h | 1 + source3/lib/talloc_stack.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'source3') diff --git a/source3/include/talloc_stack.h b/source3/include/talloc_stack.h index 331893cbd6..a2a12f8a63 100644 --- a/source3/include/talloc_stack.h +++ b/source3/include/talloc_stack.h @@ -45,6 +45,7 @@ */ TALLOC_CTX *talloc_stackframe(void); +TALLOC_CTX *talloc_stackframe_pool(size_t poolsize); /* * Get us the current top of the talloc stack. diff --git a/source3/lib/talloc_stack.c b/source3/lib/talloc_stack.c index d887b2d415..08ef2281ea 100644 --- a/source3/lib/talloc_stack.c +++ b/source3/lib/talloc_stack.c @@ -64,7 +64,7 @@ static int talloc_pop(TALLOC_CTX *frame) * not explicitly freed. */ -TALLOC_CTX *talloc_stackframe(void) +static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize) { TALLOC_CTX **tmp, *top; @@ -78,7 +78,11 @@ TALLOC_CTX *talloc_stackframe(void) talloc_stack_arraysize = talloc_stacksize + 1; } - top = talloc_new(talloc_stack); + if (poolsize) { + top = talloc_pool(talloc_stack, poolsize); + } else { + top = talloc_new(talloc_stack); + } if (top == NULL) { goto fail; @@ -94,6 +98,16 @@ TALLOC_CTX *talloc_stackframe(void) return NULL; } +TALLOC_CTX *talloc_stackframe(void) +{ + return talloc_stackframe_internal(0); +} + +TALLOC_CTX *talloc_stackframe_pool(size_t poolsize) +{ + return talloc_stackframe_internal(poolsize); +} + /* * Get us the current top of the talloc stack. */ -- cgit