mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 11:29:19 +08:00
mdbx: portability - use C11 aligned_alloc().
Change-Id: I61819614ce355c8a2597c9b26997458b3d16081c
This commit is contained in:
parent
8f7ea1844b
commit
097b274aa4
@ -279,12 +279,15 @@ int mdbx_memalign_alloc(size_t alignment, size_t bytes, void **result) {
|
||||
(void)alignment;
|
||||
*result = VirtualAlloc(NULL, bytes, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
|
||||
return *result ? MDBX_SUCCESS : MDBX_ENOMEM /* ERROR_OUTOFMEMORY */;
|
||||
#elif __GLIBC_PREREQ(2, 16) || __STDC_VERSION__ >= 201112L
|
||||
*result = memalign(alignment, bytes);
|
||||
#elif defined(_ISOC11_SOURCE)
|
||||
*result = aligned_alloc(alignment, bytes);
|
||||
return *result ? MDBX_SUCCESS : errno;
|
||||
#elif _POSIX_VERSION >= 200112L
|
||||
*result = nullptr;
|
||||
return posix_memalign(result, alignment, bytes);
|
||||
#elif __GLIBC_PREREQ(2, 16) || __STDC_VERSION__ >= 201112L
|
||||
*result = memalign(alignment, bytes);
|
||||
return *result ? MDBX_SUCCESS : errno;
|
||||
#else
|
||||
#error FIXME
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user