mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
talloc_stack: always include the location when creating a talloc_stackframe().
Much better for debugging. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
311281c2c5
commit
f9b51ff33e
@ -115,7 +115,8 @@ static int talloc_pop(TALLOC_CTX *frame)
|
|||||||
* not explicitly freed.
|
* not explicitly freed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize)
|
static TALLOC_CTX *talloc_stackframe_internal(const char *location,
|
||||||
|
size_t poolsize)
|
||||||
{
|
{
|
||||||
TALLOC_CTX **tmp, *top;
|
TALLOC_CTX **tmp, *top;
|
||||||
struct talloc_stackframe *ts =
|
struct talloc_stackframe *ts =
|
||||||
@ -151,7 +152,7 @@ static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize)
|
|||||||
if (top == NULL) {
|
if (top == NULL) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
talloc_set_name_const(top, location);
|
||||||
talloc_set_destructor(top, talloc_pop);
|
talloc_set_destructor(top, talloc_pop);
|
||||||
|
|
||||||
ts->talloc_stack[ts->talloc_stacksize++] = top;
|
ts->talloc_stack[ts->talloc_stacksize++] = top;
|
||||||
@ -162,14 +163,14 @@ static TALLOC_CTX *talloc_stackframe_internal(size_t poolsize)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TALLOC_CTX *talloc_stackframe(void)
|
TALLOC_CTX *_talloc_stackframe(const char *location)
|
||||||
{
|
{
|
||||||
return talloc_stackframe_internal(0);
|
return talloc_stackframe_internal(location, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TALLOC_CTX *talloc_stackframe_pool(size_t poolsize)
|
TALLOC_CTX *_talloc_stackframe_pool(const char *location, size_t poolsize)
|
||||||
{
|
{
|
||||||
return talloc_stackframe_internal(poolsize);
|
return talloc_stackframe_internal(location, poolsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -44,8 +44,10 @@
|
|||||||
* not explicitly freed.
|
* not explicitly freed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TALLOC_CTX *talloc_stackframe(void);
|
#define talloc_stackframe() _talloc_stackframe(__location__)
|
||||||
TALLOC_CTX *talloc_stackframe_pool(size_t poolsize);
|
#define talloc_stackframe_pool(sz) _talloc_stackframe_pool(__location__, (sz))
|
||||||
|
TALLOC_CTX *_talloc_stackframe(const char *location);
|
||||||
|
TALLOC_CTX *_talloc_stackframe_pool(const char *location, size_t poolsize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get us the current top of the talloc stack.
|
* Get us the current top of the talloc stack.
|
||||||
|
Loading…
Reference in New Issue
Block a user