[ccan] RFC: draft rfc822 module

David Gibson david at gibson.dropbear.id.au
Thu May 24 00:21:03 EST 2012


On Wed, May 23, 2012 at 09:38:30PM +0930, Paul 'Rusty' Russell wrote:
> On Tue, 22 May 2012 23:37:32 +1000, David Gibson <david at gibson.dropbear.id.au> wrote:
> > On Tue, May 22, 2012 at 01:35:14PM +0930, Paul 'Rusty' Russell wrote:
> > > Error handling could be done here:
> > > 
> > >         static void *myalloc(struct rfc822 *msg, size_t len)
> > >         {
> > >                 void *ret = talloc(msg, len);
> > >                 if (!ret) {
> > >                         struct myrfc822 *mymsg = (struct myrfc822 *)msg;
> > >                         mymsg->alloc_failed++;
> > >                 }
> > >                 return ret;
> > >         }
> > 
> > I don't quite see what that does differently from what I already
> > have.  It already requires talloc, and internal data structures are
> > allocated using the message structure as a context.
> 
> Indeed.  Since ccan/talloc lets you set the alloc functions already,
> your error handing function is redundant.
> 
> However, default talloc doesn't... so might as well leave it as it is,
> with a global handler.

Uh... huh?  I'm completely lost.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson


More information about the ccan mailing list