blob: 1b468cb4ae9e8864d7c8a04adf00648c5c7c40ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#pragma once
#include <al/lib.h>
static inline void *camu_page_alloc(size_t size)
{
#ifdef AL_HAVE_POSIX_MEMALIGN
void *ptr = NULL;
if (al_posix_memalign(&ptr, al_page_size, size) != 0) {
// For possible EINVAL rather than ENOMEM.
return NULL;
}
return ptr;
#else
return al_malloc(size);
#endif
}
static inline void *camu_page_realloc(void *ptr, size_t size)
{
return al_realloc(ptr, size);
}
|