diff --git a/h_malloc.c b/h_malloc.c index 91eb6ca..a610683 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -1808,24 +1808,18 @@ EXPORT int h_malloc_trim(UNUSED size_t pad) { EXPORT void h_malloc_stats(void) {} +#if defined(__GLIBC__) || defined(__ANDROID__) // glibc mallinfo is broken and replaced with mallinfo2 #if defined(__GLIBC__) EXPORT struct mallinfo h_mallinfo(void) { return (struct mallinfo){0}; } -#if __GLIBC_PREREQ(2, 33) -#define HAVE_MALLINFO2 -#endif -#endif - -#if defined(HAVE_MALLINFO2) || defined(__ANDROID__) -#ifndef __GLIBC__ -EXPORT struct mallinfo h_mallinfo(void) { - struct mallinfo info = {0}; -#else EXPORT struct mallinfo2 h_mallinfo2(void) { struct mallinfo2 info = {0}; +#else +EXPORT struct mallinfo h_mallinfo(void) { + struct mallinfo info = {0}; #endif #if CONFIG_STATS diff --git a/test/mallinfo2.c b/test/mallinfo2.c index ccabf48..2f4cd33 100644 --- a/test/mallinfo2.c +++ b/test/mallinfo2.c @@ -9,7 +9,6 @@ static void print_mallinfo2(void) { #if defined(__GLIBC__) -#if __GLIBC_PREREQ(2, 33) struct mallinfo2 info = mallinfo2(); printf("mallinfo2:\n"); printf("arena: %zu\n", (size_t)info.arena); @@ -23,7 +22,6 @@ static void print_mallinfo2(void) { printf("fordblks: %zu\n", (size_t)info.fordblks); printf("keepcost: %zu\n", (size_t)info.keepcost); #endif -#endif } OPTNONE int main(void) {