diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-12-01 13:43:10 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-12-01 13:43:10 +0100 |
commit | 08fa92c1c94d9faddee48590a1a20506e89c191c (patch) | |
tree | 12bbf6fa56b69c47340d4c15f8f601be2d9487b5 /source/luametatex/source/libraries/mimalloc/src/alloc-posix.c | |
parent | 2593c827482f6c5a315d504cd5316879d6172656 (diff) | |
download | context-08fa92c1c94d9faddee48590a1a20506e89c191c.tar.gz |
2022-12-01 12:41:00
Diffstat (limited to 'source/luametatex/source/libraries/mimalloc/src/alloc-posix.c')
-rw-r--r-- | source/luametatex/source/libraries/mimalloc/src/alloc-posix.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/luametatex/source/libraries/mimalloc/src/alloc-posix.c b/source/luametatex/source/libraries/mimalloc/src/alloc-posix.c index 176e7ec30..214a97345 100644 --- a/source/luametatex/source/libraries/mimalloc/src/alloc-posix.c +++ b/source/luametatex/source/libraries/mimalloc/src/alloc-posix.c @@ -83,13 +83,16 @@ mi_decl_nodiscard mi_decl_restrict void* mi_pvalloc(size_t size) mi_attr_noexcep } mi_decl_nodiscard mi_decl_restrict void* mi_aligned_alloc(size_t alignment, size_t size) mi_attr_noexcept { - if (mi_unlikely((size&(alignment-1)) != 0)) { // C11 requires alignment>0 && integral multiple, see <https://en.cppreference.com/w/c/memory/aligned_alloc> + // C11 requires the size to be an integral multiple of the alignment, see <https://en.cppreference.com/w/c/memory/aligned_alloc>. + // unfortunately, it turns out quite some programs pass a size that is not an integral multiple so skip this check.. + /* if mi_unlikely((size & (alignment - 1)) != 0) { // C11 requires alignment>0 && integral multiple, see <https://en.cppreference.com/w/c/memory/aligned_alloc> #if MI_DEBUG > 0 _mi_error_message(EOVERFLOW, "(mi_)aligned_alloc requires the size to be an integral multiple of the alignment (size %zu, alignment %zu)\n", size, alignment); #endif return NULL; } - // C11 also requires alignment to be a power-of-two which is checked in mi_malloc_aligned + */ + // C11 also requires alignment to be a power-of-two (and > 0) which is checked in mi_malloc_aligned void* p = mi_malloc_aligned(size, alignment); mi_assert_internal(((uintptr_t)p % alignment) == 0); return p; @@ -109,7 +112,7 @@ mi_decl_nodiscard int mi_reallocarr( void* p, size_t count, size_t size ) mi_att } void** op = (void**)p; void* newp = mi_reallocarray(*op, count, size); - if (mi_unlikely(newp == NULL)) return errno; + if mi_unlikely(newp == NULL) { return errno; } *op = newp; return 0; } |