diff options
author | Jeremy Allison <jra@samba.org> | 2008-01-09 17:07:58 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-01-09 17:07:58 -0800 |
commit | 5df6018114ca54d97a7d67d554a090a56270d45e (patch) | |
tree | ca0a88e03555595c10f439b82f2b08cd893d3758 /source3 | |
parent | 1ed4fcb271b7885c274bd88bafed8116779d8eb6 (diff) | |
download | samba-5df6018114ca54d97a7d67d554a090a56270d45e.tar.gz samba-5df6018114ca54d97a7d67d554a090a56270d45e.tar.bz2 samba-5df6018114ca54d97a7d67d554a090a56270d45e.zip |
Add the calls to make use of talloc_pools in a talloc_stackframe.
Jeremy.
(This used to be commit d27e6c0548d21394f6399d3b737d175ffed8420d)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/talloc_stack.h | 1 | ||||
-rw-r--r-- | source3/lib/talloc_stack.c | 18 |
2 files changed, 17 insertions, 2 deletions
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. */ |