mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 10:05:29 +00:00
I tried using 'svn merge' to do the merge but it did a terrible job and there were bazillions of conflicts. So instead I just took the diff between the branch and trunk at r10155, applied the diff to the trunk, 'svn add'ed the added files (no files needed to be 'svn remove'd) and committed. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10156
28 lines
572 B
C
28 lines
572 B
C
// Replacement for malloc.h which factors out platform differences.
|
|
|
|
#include <stdlib.h>
|
|
#if defined(VGO_darwin)
|
|
# include <malloc/malloc.h>
|
|
#else
|
|
# include <malloc.h>
|
|
#endif
|
|
|
|
#include <assert.h>
|
|
|
|
// Allocates a 16-aligned block. Asserts if the allocation fails.
|
|
__attribute__((unused))
|
|
static void* memalign16(size_t szB)
|
|
{
|
|
void* x;
|
|
#if defined(VGO_darwin)
|
|
// Darwin lacks memalign, but its malloc is always 16-aligned anyway.
|
|
x = malloc(szB);
|
|
#else
|
|
x = memalign(16, szB);
|
|
#endif
|
|
assert(x);
|
|
assert(0 == ((16-1) & (unsigned long)x));
|
|
return x;
|
|
}
|
|
|