:: Re: [DNG] int essid_alloc is causin…
Inizio della pagina
Delete this message
Reply to this message
Autore: Jaromil
Data:  
To: dng
Oggetto: Re: [DNG] int essid_alloc is causing valgrind to report a series of errors
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