Add HB_CUSTOM_MALLOC definition

So one can use just HB_CUSTOM_MALLOC instead need for define each of hb_*alloc_impl
This commit is contained in:
Ebrahim Byagowi 2020-07-15 09:38:12 +04:30 committed by GitHub
parent 60959b08e5
commit 7c433ffde2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -205,10 +205,15 @@
/* Compile-time custom allocator support. */
#if defined(hb_malloc_impl) \
&& defined(hb_calloc_impl) \
&& defined(hb_realloc_impl) \
&& defined(hb_free_impl)
#if !defined(HB_CUSTOM_MALLOC) \
&& defined(hb_malloc_impl) \
&& defined(hb_calloc_impl) \
&& defined(hb_realloc_impl) \
&& defined(hb_free_impl)
#define HB_CUSTOM_MALLOC
#endif
#ifdef HB_CUSTOM_MALLOC
extern "C" void* hb_malloc_impl(size_t size);
extern "C" void* hb_calloc_impl(size_t nmemb, size_t size);
extern "C" void* hb_realloc_impl(void *ptr, size_t size);