The precise meaning of talloc_tos()

Richard Sharpe realrichardsharpe at gmail.com
Sat Apr 7 13:41:23 MDT 2012


Hi folks,

I noticed this comment in lib/util/talloc_stack.h

/*
 * Implement a stack of talloc frames.
 *
 * When a new talloc stackframe is allocated with talloc_stackframe(), then
 * the TALLOC_CTX returned with talloc_tos() is reset to that new
 * frame. Whenever that stack frame is TALLOC_FREE()'ed, then the reverse
 * happens: The previous talloc_tos() is restored.
 *

My question hinges around the use of the word reset above in "the
TALLOC_CTX returned with talloc_tos() is *reset* to that new frame."

I think that the code in talloc_stackframe.c shows that reset is the
wrong word there and it simply returns the context associated with the
current top of the talloc stack or a new one if no stack yet exists,
however, given my recent demonstrated ability to mis-read code, can
someone confirm :-)

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list