drop legacy glibc support
parent
95c4b40caf
commit
64dad0a69f
14
h_malloc.c
14
h_malloc.c
|
@ -1808,24 +1808,18 @@ EXPORT int h_malloc_trim(UNUSED size_t pad) {
|
||||||
|
|
||||||
EXPORT void h_malloc_stats(void) {}
|
EXPORT void h_malloc_stats(void) {}
|
||||||
|
|
||||||
|
#if defined(__GLIBC__) || defined(__ANDROID__)
|
||||||
// glibc mallinfo is broken and replaced with mallinfo2
|
// glibc mallinfo is broken and replaced with mallinfo2
|
||||||
#if defined(__GLIBC__)
|
#if defined(__GLIBC__)
|
||||||
EXPORT struct mallinfo h_mallinfo(void) {
|
EXPORT struct mallinfo h_mallinfo(void) {
|
||||||
return (struct mallinfo){0};
|
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) {
|
EXPORT struct mallinfo2 h_mallinfo2(void) {
|
||||||
struct mallinfo2 info = {0};
|
struct mallinfo2 info = {0};
|
||||||
|
#else
|
||||||
|
EXPORT struct mallinfo h_mallinfo(void) {
|
||||||
|
struct mallinfo info = {0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_STATS
|
#if CONFIG_STATS
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
static void print_mallinfo2(void) {
|
static void print_mallinfo2(void) {
|
||||||
#if defined(__GLIBC__)
|
#if defined(__GLIBC__)
|
||||||
#if __GLIBC_PREREQ(2, 33)
|
|
||||||
struct mallinfo2 info = mallinfo2();
|
struct mallinfo2 info = mallinfo2();
|
||||||
printf("mallinfo2:\n");
|
printf("mallinfo2:\n");
|
||||||
printf("arena: %zu\n", (size_t)info.arena);
|
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("fordblks: %zu\n", (size_t)info.fordblks);
|
||||||
printf("keepcost: %zu\n", (size_t)info.keepcost);
|
printf("keepcost: %zu\n", (size_t)info.keepcost);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTNONE int main(void) {
|
OPTNONE int main(void) {
|
||||||
|
|
Loading…
Reference in New Issue