talloc_tos() in common code

Jeremy Allison jra at samba.org
Wed Apr 13 09:45:30 MDT 2011


On Wed, Apr 13, 2011 at 01:35:56PM +0200, Stefan (metze) Metzmacher wrote:
> Hi,
> 
> I wonder why we can't use the talloc_tos() infrastructure in common code?
> 
> I know that we can't use talloc_tos() directly, because the stackframe
> might not be in place, but I think we could use something like this:
> 
> TALLOC_CTX *frame = talloc_stackframe();
> 
> some code ...
> 
> talloc_free(frame)
> 
> This way we'll make use of a talloc pool if the caller
> used talloc_stackframe_pool().

I think this is a good idea. talloc_tos() is such a
useful concept that working without it tends to make
code a lot more clumsy.

Jeremy.


More information about the samba-technical mailing list