cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [Patch] lib/config-dos.h

From: Yang Tse <yangsita_at_gmail.com>
Date: Fri, 15 Feb 2013 03:13:16 +0100

On Thu, Feb 14, 2013 at 6:28 PM, Gisle Vanem <gvanem_at_broadpark.no> wrote:

Pushed your changes, although #2 done differently.

> Also I have a beef with the 'NEED_MALLOC_H' used in some places.
> What's the distinction between having some header and needing a header?

Having a header file is not reason enough to include it. It is true
that for most headers when configure script finds out that it exists
it defines HAVE_XXX_H symbol.

Not so old versions of autoconf defined HAVE_XXX_H as soon as the file
existed, more recent versions also require that the header file
compiles.

And there are times when a given header files exists, but we do not
want it included unless we really _need_ it. malloc.h is a beast of
that kind. That's the reason for such clear distinction.

If you are trying to figure out for some specific system what should
be defined, use the following heuristic. Don't define HAVE_MALLOC_H
nor NEED_MALLOC_H and see if everything compiles and works nicely.
OTOH If you get errors about implicit declarations of malloc() free()
etc, and you have malloc.h define NEED_MALLOC_H and try again.

> We absolutely need <string.h> and other str*() functions everywhere, so why
> aren't there a NEED_STRING_H/NEED_STRINGS_H also? IMHO, it should be renamed
> to HAVE_MALLOC_H.

Certainly no.

-- 
-=[Yang]=-
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-02-15