iglunix/pkgs/tbb/musl-malloc-proxy.patch
2021-06-29 23:30:28 +01:00

38 lines
1.2 KiB
Diff

--- a/src/tbbmalloc_proxy/proxy.cpp
+++ b/src/tbbmalloc_proxy/proxy.cpp
@@ -24,7 +24,8 @@
// of aligned_alloc as required by new C++ standard, this makes it hard to
// redefine aligned_alloc here. However, running on systems with new libc
// version, it still needs it to be redefined, thus tricking system headers
-#if defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 16) && _GLIBCXX_HAVE_ALIGNED_ALLOC
+#if defined(__GLIBC_PREREQ)
+#if !__GLIBC_PREREQ(2, 16) && _GLIBCXX_HAVE_ALIGNED_ALLOC
// tell <cstdlib> that there is no aligned_alloc
#undef _GLIBCXX_HAVE_ALIGNED_ALLOC
// trick <stdlib.h> to define another symbol instead
@@ -32,7 +33,8 @@
// Fix the state and undefine the trick
#include <cstdlib>
#undef aligned_alloc
-#endif // defined(__GLIBC_PREREQ)&&!__GLIBC_PREREQ(2, 16)&&_GLIBCXX_HAVE_ALIGNED_ALLOC
+#endif // !__GLIBC_PREREQ(2, 16)&&_GLIBCXX_HAVE_ALIGNED_ALLOC
+#endif // defined(__GLIBC_PREREQ)
#endif // __linux__ && !__ANDROID__
#include "proxy.h"
@@ -253,6 +255,7 @@
return 1;
}
+#ifdef __GLIBC__
struct mallinfo mallinfo() __THROW
{
struct mallinfo m;
@@ -260,6 +263,7 @@
return m;
}
+#endif
#if __ANDROID__
// Android doesn't have malloc_usable_size, provide it to be compatible