On Wed, 14 Oct 2015, Mat wrote:

> Is there a reason why you need to write such a wrapper around calloc()?

good question. I also have been tempted to do that in the past.

> It adds very little since calloc already sets errno. Plus it's a rather
> unnatural construct for an allocator to return the allocated buffer this
> way.
> 
> if ((err = essid_alloc(len, &buf)) != 0)
>       handle_error(err);
> 
> if (!(buf = calloc(1, len)))
>       handle_error(errno);

I like the second! its less code and less layering

> I didn't follow the discussion, just looking at this code without context.

perfect way to jump in, minimalism is very welcome here :)

ciao

_______________________________________________
Dng mailing list
Dng@lists.dyne.org
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng

Reply via email to