cURL / Mailing Lists / curl-library / Single Mail


Re: Modifying the example source code

From: Tor Arntsen <>
Date: Mon, 28 Feb 2011 09:34:58 +0100

On Mon, Feb 28, 2011 at 07:28, Alan Wolfe <> wrote:

> Basically, it allocates a single byte so there's a valid memory
> address in chunk.memory so that realloc can be called on it later on.
> If it started out NULL, there would have to be an if check before the
> realloc call, so it just simplifies things a little.

Just to pre-answer a question people may ask.. realloc(NULL) works
fine on many architectures. But not on all architectures. To be
perfectly portable we use the malloc(1) trick.

List admin:
Received on 2011-02-28