mallinfo2: include malloc header even if mallinfo undetected

It may be the case that for some reason, -Werror deprecated
for instance, that mallinfo isn't detected. In this case the
malloc.h headers won't be included which defined the mallinfo2
function and its structure.

Re-organise so that either function pulls in the header.
This commit is contained in:
Daniel Black 2023-11-29 12:23:46 +11:00
parent 705f7ab620
commit 1fec50120f

View File

@ -27,11 +27,13 @@
#include "my_json_writer.h"
#include <hash.h>
#include <thr_alarm.h>
#if defined(HAVE_MALLINFO) && defined(HAVE_MALLOC_H)
#if defined(HAVE_MALLINFO) || defined(HAVE_MALLINFO2)
#if defined(HAVE_MALLOC_H)
#include <malloc.h>
#elif defined(HAVE_MALLINFO) && defined(HAVE_SYS_MALLOC_H)
#elif defined(HAVE_SYS_MALLOC_H)
#include <sys/malloc.h>
#endif
#endif
#ifdef HAVE_EVENT_SCHEDULER
#include "events.h"