tdb and ldb

Rusty Russell rusty at rustcorp.com.au
Mon Feb 6 12:56:07 MST 2012


On Fri, 03 Feb 2012 18:12:31 -0500, simo <idra at samba.org> wrote:
> > +struct tdb_attribute_allocator {
> > +       struct tdb_attribute_base base; /* .attr = TDB_ATTRIBUTE_ALLOCATOR */
> > +       void *(*alloc)(const void *owner, size_t len);
> > +       void *(*expand)(void *old, size_t newlen);
> > +       void (*free)(void *old);
> > +};
> > +
> > +/** 
> 
> If you want this to be really generic you should pass the void * pointer
> to all routines. When you use allocation pools you may need the pool
> also to do the expand and the free as the information about the pool may
> not be embedded in the pointer.

Yes, always true of callbacks; it's an incredible pain if you need it
and it's not there.

Added, thanks!

Cheers,
Rusty.


More information about the samba-technical mailing list