add android support (#171)

* adjust for android

* update docs

* add const qualifier to `alloc_size`

* check const qualifier in cmake
This commit is contained in:
SchrodingerZhu
2020-04-18 14:58:13 +08:00
committed by GitHub
parent 0f5cc165e8
commit a43773c5b7
8 changed files with 43 additions and 10 deletions

View File

@@ -14,6 +14,10 @@ using namespace snmalloc;
# define SNMALLOC_NAME_MANGLE(a) a
#endif
#ifndef MALLOC_USABLE_SIZE_QUALIFIER
# define MALLOC_USABLE_SIZE_QUALIFIER
#endif
extern "C"
{
SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(__malloc_end_pointer)(void* ptr)
@@ -43,7 +47,9 @@ extern "C"
return ThreadAlloc::get_noncachable()->alloc<ZeroMem::YesZero>(sz);
}
SNMALLOC_EXPORT size_t SNMALLOC_NAME_MANGLE(malloc_usable_size)(void* ptr)
SNMALLOC_EXPORT
size_t SNMALLOC_NAME_MANGLE(malloc_usable_size)(
MALLOC_USABLE_SIZE_QUALIFIER void* ptr)
{
return Alloc::alloc_size(ptr);
}