diff options
author | jvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-28 05:59:44 +0000 |
---|---|---|
committer | jvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-28 05:59:44 +0000 |
commit | 0a72447fb90b7d8ab0ab07119098a46ba84f0c86 (patch) | |
tree | d96bb718af0a279e1d3fe7eb56fb73cf8a14ac6e | |
parent | dd868dcc5094fa78af7ff05262e12eb8f1fef78a (diff) | |
download | chromium_src-0a72447fb90b7d8ab0ab07119098a46ba84f0c86.zip chromium_src-0a72447fb90b7d8ab0ab07119098a46ba84f0c86.tar.gz chromium_src-0a72447fb90b7d8ab0ab07119098a46ba84f0c86.tar.bz2 |
Use posix_memalign for OS_NACL instead of memalign, remove TODO for docs.
We finally added it to the nacl newlib headers. Besides the
headers there used to be a bug in the posix_memalign
implementation which prevented it from being useful. That's also fixed.
BUG=138579
Review URL: https://codereview.chromium.org/89703005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237695 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/memory/aligned_memory.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/base/memory/aligned_memory.cc b/base/memory/aligned_memory.cc index b6278ab..5ec88b1 100644 --- a/base/memory/aligned_memory.cc +++ b/base/memory/aligned_memory.cc @@ -6,7 +6,7 @@ #include "base/logging.h" -#if defined(OS_ANDROID) || defined(OS_NACL) +#if defined(OS_ANDROID) #include <malloc.h> #endif @@ -19,13 +19,12 @@ void* AlignedAlloc(size_t size, size_t alignment) { void* ptr = NULL; #if defined(COMPILER_MSVC) ptr = _aligned_malloc(size, alignment); -// Both Android and NaCl technically support posix_memalign(), but do not expose -// it in the current version of the library headers used by Chrome. Luckily, -// memalign() on both platforms returns pointers which can safely be used with -// free(), so we can use it instead. Issues filed with each project for docs: +// Android technically supports posix_memalign(), but does not expose it in +// the current version of the library headers used by Chrome. Luckily, +// memalign() on Android returns pointers which can safely be used with +// free(), so we can use it instead. Issue filed to document this: // http://code.google.com/p/android/issues/detail?id=35391 -// http://code.google.com/p/chromium/issues/detail?id=138579 -#elif defined(OS_ANDROID) || defined(OS_NACL) +#elif defined(OS_ANDROID) ptr = memalign(alignment, size); #else if (posix_memalign(&ptr, alignment, size)) |