[PATCH] Add stackframes to public libsmbclient functions

simo idra at samba.org
Tue Nov 20 14:14:51 GMT 2007


On Tue, 2007-11-20 at 08:55 +0100, Volker Lendecke wrote:
> On Tue, Nov 20, 2007 at 09:55:31AM +0300, Alexander Bokovoy wrote:
> > >Volker, I am ok with stackframe the only thing I don't digest yet is
> > >the use of an implicit destructor (can be replaced in theory) but
> > >samba3 code never uses destructors so I am ok with its use
> > DBWRAP code in Samba 3 uses destructors, see
> > source/lib/dbwrap_tdb.c:db_tdb_record_destr(). It even allocates childs
> > in destructor in relies on 'childs freed after calling destructor'
> > semantics.
> 
> If all of you are against this construct, why can't you
> comment on it when I checked it in in the first place? Now
> it is going to be a fucking hell lot of work to remove it
> all again!!

Volker,
nobody here is proposing removing it.

I just wanted to point out that talloc_stackframe() implies a
talloc_set_destructor() on the context and people must avoid setting
destructors on the context or they will overwrite the existing one.

It is unlikely that anybody will do that as temporary contexts usually
live inside a function and there is never need to add destructors in
that case as you have direct access to the context for a
talloc_free(ctx).

Adding children with destructors to a talloc_stackframe context is
perfectly fine.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Senior Software Engineer at Red Hat Inc. <ssorce at redhat.com>



More information about the samba-technical mailing list