ADT
arm-eh
ast-experimental
cleanup-dtors
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Last change
on this file since 98d4df9 was bf71cfd, checked in by Thierry Delisle <tdelisle@…>, 7 years ago |
Moved up many directories in source
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /*
|
---|
2 | * Allocation functions (posix_malign)
|
---|
3 | *
|
---|
4 | * Copyright (c) 2014, 2015 Gregor Richards
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, and/or distribute this software for any
|
---|
7 | * purpose with or without fee is hereby granted, provided that the above
|
---|
8 | * copyright notice and this permission notice appear in all copies.
|
---|
9 | *
|
---|
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
---|
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
---|
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
---|
13 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
---|
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
---|
15 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
---|
16 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
17 | */
|
---|
18 |
|
---|
19 | static void *allocPool(size_t size, int mustSucceed)
|
---|
20 | {
|
---|
21 | void *ret;
|
---|
22 | if ((errno = posix_memalign(&ret, size, size))) {
|
---|
23 | if (mustSucceed) {
|
---|
24 | perror("posix_memalign");
|
---|
25 | abort();
|
---|
26 | }
|
---|
27 | return NULL;
|
---|
28 | }
|
---|
29 | return ret;
|
---|
30 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.