hmm.. Re: talloc issues

Rusty Russell rusty at
Tue Aug 4 19:45:11 MDT 2009

On Tue, 4 Aug 2009 11:16:20 pm Sam Liddicott wrote:
> * Rusty Russell wrote, On 04/08/09 02:20:
> > Tridge's "ban talloc_free" did this at runtime.  I think there's scope to
> > argue that this code should be changed completely to break at compile time
> > instead, (ie. return a "struct upcase" which is a real talloc object, and
> > does the string refcounting internally in the destructor).
> Or maybe to be generic with "struct smartptr" (except in C it would be a
> dumb pointer).

Interesting idea.  I considered something similar for a while: a realloc callback which would allow pointers to magically move when an object is realloced.  Auto-zeroing would be a special case.

But your suggestion can be implemented entirely external to talloc; perhaps we should open code it where needed until we've nailed down the pattern?

(Note: there may be a valid use of references other than the cache pattern which I haven't seen yet, too).


More information about the samba-technical mailing list