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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "native_client/src/shared/platform/aligned_malloc.h" 7 #include "native_client/src/shared/platform/aligned_malloc.h"
8 8
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11
Mark Seaborn 2012/11/02 15:35:57 Don't change the spacing unnecessarily, please. T
Nikolay 2012/11/06 11:09:05 Done.
12 void *NaClAlignedMalloc(size_t size, size_t alignment) { 11 void *NaClAlignedMalloc(size_t size, size_t alignment) {
12 #if NACL_ANDROID
13 return memalign(alignment, size);
Mark Seaborn 2012/11/02 15:35:57 Android added posix_memalign() in December 2011 in
Nikolay 2012/11/06 11:09:05 Done.
14 #else
13 void *block; 15 void *block;
14 if (posix_memalign(&block, alignment, size) != 0) 16 if (posix_memalign(&block, alignment, size) != 0)
15 return NULL; 17 return NULL;
16 return block; 18 return block;
19 #endif
17 } 20 }
18 21
19 void NaClAlignedFree(void *block) { 22 void NaClAlignedFree(void *block) {
20 free(block); 23 free(block);
21 } 24 }
OLDNEW
« 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