Skip to content

Instantly share code, notes, and snippets.

@modocache
Created April 19, 2016 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modocache/25832af9c3736dec2b85f66855103242 to your computer and use it in GitHub Desktop.
Save modocache/25832af9c3736dec2b85f66855103242 to your computer and use it in GitHub Desktop.
diff --git a/stdlib/public/stubs/LibcShims.cpp b/stdlib/public/stubs/LibcShims.cpp
index cb750f1..a3164fa 100644
--- a/stdlib/public/stubs/LibcShims.cpp
+++ b/stdlib/public/stubs/LibcShims.cpp
@@ -52,7 +52,7 @@ int _swift_stdlib_close(int fd) { return close(fd); }
#if defined(__APPLE__)
#include <malloc/malloc.h>
size_t _swift_stdlib_malloc_size(const void *ptr) { return malloc_size(ptr); }
-#elif defined(__GNU_LIBRARY__) || defined(__CYGWIN__)
+#elif defined(__GNU_LIBRARY__) || defined(__CYGWIN__) || defined(__ANDROID__)
#include <malloc.h>
size_t _swift_stdlib_malloc_size(const void *ptr) {
return malloc_usable_size(const_cast<void *>(ptr));
@@ -62,13 +62,6 @@ size_t _swift_stdlib_malloc_size(const void *ptr) {
size_t _swift_stdlib_malloc_size(const void *ptr) {
return malloc_usable_size(const_cast<void *>(ptr));
}
-#elif defined(__ANDROID__)
-extern "C" {
-extern size_t dlmalloc_usable_size(void*);
-}
-size_t _swift_stdlib_malloc_size(const void *ptr) {
- return dlmalloc_usable_size(const_cast<void *>(ptr));
-}
#else
#error No malloc_size analog known for this platform/libc.
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment