diff options
author | Eugene Kosov <claprix@yandex.ru> | 2019-12-17 21:50:58 +0800 |
---|---|---|
committer | Eugene Kosov <claprix@yandex.ru> | 2019-12-18 20:09:52 +0800 |
commit | 3d3d8f10120dd2311ef8195d19389c4a1e85786b (patch) | |
tree | ad44351a9b9048263cf858550a66175cf7606099 /storage/xtradb | |
parent | 984b3c15449e0b5c7b3d66047a3c490c7be40faf (diff) | |
download | mariadb-git-3d3d8f10120dd2311ef8195d19389c4a1e85786b.tar.gz |
MDEV-21337 fix aligned_malloc()
do not fallback to malloc(), always return properly aligned buffer
Diffstat (limited to 'storage/xtradb')
-rw-r--r-- | storage/xtradb/CMakeLists.txt | 5 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0buf.cc | 9 |
2 files changed, 3 insertions, 11 deletions
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt index cc269b44201..465d93eafc5 100644 --- a/storage/xtradb/CMakeLists.txt +++ b/storage/xtradb/CMakeLists.txt @@ -93,11 +93,6 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-class-memaccess") IF(NOT MSVC) - CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN) - IF(HAVE_POSIX_MEMALIGN) - ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN) - ENDIF() - # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not # workaround for old gcc on x86, gcc atomic ops only work under -march=i686 IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 6ddcc3521da..398e1e84994 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -92,17 +92,14 @@ buf_mark_space_corrupt( /* prototypes for new functions added to ha_innodb.cc */ trx_t* innobase_get_trx(); -inline void* aligned_malloc(size_t size, size_t align) { +static void* aligned_malloc(size_t size, size_t align) { void *result; #ifdef _MSC_VER result = _aligned_malloc(size, align); -#elif defined (HAVE_POSIX_MEMALIGN) +#else if(posix_memalign(&result, align, size)) { - result = 0; + result = NULL; } -#else - /* Use unaligned malloc as fallback */ - result = malloc(size); #endif return result; } |