Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1081)

Unified Diff: src/shared/platform/posix/aligned_malloc.c

Issue 11364047: Android doesn't have posix_memalign(), so use memalign() (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/shared/platform/posix/aligned_malloc.c
===================================================================
--- src/shared/platform/posix/aligned_malloc.c (revision 10196)
+++ src/shared/platform/posix/aligned_malloc.c (working copy)
@@ -10,10 +10,21 @@
void *NaClAlignedMalloc(size_t size, size_t alignment) {
+ /*
+ * Bionic in Android ICS (4.0) and earlier doesn't have
+ * posix_memalign(), so we shall use memalign(), which
+ * luckily returns free()'able memory.
Mark Seaborn 2012/11/06 13:54:44 How about: "luckily, in Bionic, returns free()'abl
+ * TODO(olonho): once/if we'll obsolete 4.0 support remove this
+ * #ifdef.
+ */
+#if NACL_ANDROID
+ return memalign(alignment, size);
+#else
void *block;
if (posix_memalign(&block, alignment, size) != 0)
return NULL;
return block;
+#endif
}
void NaClAlignedFree(void *block) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698