|
|
@ -76,7 +76,7 @@ static int allocate_memory(block_region **region, uint32_t m_cost); |
|
|
|
static int |
|
|
|
allocate_memory(block_region **region, uint32_t m_cost) |
|
|
|
{ |
|
|
|
void * base; |
|
|
|
void *base; |
|
|
|
block *memory; |
|
|
|
size_t memory_size; |
|
|
|
|
|
|
@ -99,12 +99,12 @@ allocate_memory(block_region **region, uint32_t m_cost) |
|
|
|
-1, 0)) == MAP_FAILED) { |
|
|
|
base = NULL; /* LCOV_EXCL_LINE */ |
|
|
|
} /* LCOV_EXCL_LINE */ |
|
|
|
memcpy(&memory, &base, sizeof memory); |
|
|
|
memory = (block *) base; |
|
|
|
#elif defined(HAVE_POSIX_MEMALIGN) |
|
|
|
if ((errno = posix_memalign((void **) &base, 64, memory_size)) != 0) { |
|
|
|
base = NULL; |
|
|
|
} |
|
|
|
memcpy(&memory, &base, sizeof memory); |
|
|
|
memory = (block *) base; |
|
|
|
#else |
|
|
|
memory = NULL; |
|
|
|
if (memory_size + 63 < memory_size) { |
|
|
@ -113,7 +113,7 @@ allocate_memory(block_region **region, uint32_t m_cost) |
|
|
|
} else if ((base = malloc(memory_size + 63)) != NULL) { |
|
|
|
uint8_t *aligned = ((uint8_t *) base) + 63; |
|
|
|
aligned -= (uintptr_t) aligned & 63; |
|
|
|
memcpy(&memory, &aligned, sizeof memory); |
|
|
|
memory = (block *) aligned; |
|
|
|
} |
|
|
|
#endif |
|
|
|
if (base == NULL) { |
|
|
|