[PATCH v2 25/25] Including <malloc.h> iff it exists.

Andrew Clayton andrew at digital-domain.net
Mon Jun 20 14:47:19 UTC 2022


On Mon, 20 Jun 2022 09:11:08 +0200
Alejandro Colomar <alx.manpages at gmail.com> wrote:

> ---
>  auto/headers   | 13 +++++++++++++
>  src/nxt_unix.h |  6 ++++--
>  2 files changed, 17 insertions(+), 2 deletions(-)

[...]

> diff --git a/src/nxt_unix.h b/src/nxt_unix.h
> index 60062610..891375fc 100644
> --- a/src/nxt_unix.h
> +++ b/src/nxt_unix.h
> @@ -11,6 +11,10 @@
>  
>  #include <sys/syscall.h>
>  
> +#if (NXT_HAVE_MALLOC_H)
> +#include <malloc.h>
> +#endif
> +
>  
>  #if (NXT_LINUX)
>  
> @@ -32,8 +36,6 @@
>  
>  #define _FILE_OFFSET_BITS  64
>  
> -#include <malloc.h>                 /* malloc_usable_size(). */
> -
>  #if (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 4)
>  /*
>   * POSIX semaphores using NPTL atomic/futex operations

So to re-cap (from the other email, Message-ID:
<20220620153231.28d6cfd8 at kappa.digital-domain.net>) this breaks the
build on at least Linux due to malloc.h being included before
_GNU_SOURCE is defined.

_GNU_SOURCE needs to be defined before features.h is included and
malloc.h includes features.h before _GNU_SOURCE is being defined now.

Cheers,
Andrew



More information about the unit mailing list