Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
3d3d8f10
Commit
3d3d8f10
authored
Dec 17, 2019
by
Eugene Kosov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-21337 fix aligned_malloc()
do not fallback to malloc(), always return properly aligned buffer
parent
984b3c15
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
26 deletions
+10
-26
storage/innobase/CMakeLists.txt
storage/innobase/CMakeLists.txt
+0
-5
storage/innobase/buf/buf0buf.cc
storage/innobase/buf/buf0buf.cc
+7
-10
storage/xtradb/CMakeLists.txt
storage/xtradb/CMakeLists.txt
+0
-5
storage/xtradb/buf/buf0buf.cc
storage/xtradb/buf/buf0buf.cc
+3
-6
No files found.
storage/innobase/CMakeLists.txt
View file @
3d3d8f10
...
...
@@ -94,11 +94,6 @@ IF(NOT MSVC)
SET_SOURCE_FILES_PROPERTIES
(
trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1
)
ENDIF
()
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
...
...
storage/innobase/buf/buf0buf.cc
View file @
3d3d8f10
...
...
@@ -82,19 +82,16 @@ Created 11/5/1995 Heikki Tuuri
#include "snappy-c.h"
#endif
inline
void
*
aligned_malloc
(
size_t
size
,
size_t
align
)
{
void
*
result
;
static
void
*
aligned_malloc
(
size_t
size
,
size_t
align
)
{
#ifdef _MSC_VER
result
=
_aligned_malloc
(
size
,
align
);
#elif defined (HAVE_POSIX_MEMALIGN)
if
(
posix_memalign
(
&
result
,
align
,
size
))
{
result
=
0
;
}
return
_aligned_malloc
(
size
,
align
);
#else
/* Use unaligned malloc as fallback */
result
=
malloc
(
size
);
void
*
result
;
if
(
posix_memalign
(
&
result
,
align
,
size
))
result
=
NULL
;
#endif
return
result
;
return
result
;
}
inline
void
aligned_free
(
void
*
ptr
)
{
...
...
storage/xtradb/CMakeLists.txt
View file @
3d3d8f10
...
...
@@ -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
...
...
storage/xtradb/buf/buf0buf.cc
View file @
3d3d8f10
...
...
@@ -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
);
#el
if defined (HAVE_POSIX_MEMALIGN)
#el
se
if
(
posix_memalign
(
&
result
,
align
,
size
))
{
result
=
0
;
result
=
NULL
;
}
#else
/* Use unaligned malloc as fallback */
result
=
malloc
(
size
);
#endif
return
result
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment