Add option --loop-till-fail to tests/vg_regtests
[valgrind.git] / tests / malloc.h
blob0179b387cc393937cf8ab2bb73a625a82ff8325a
1 // Replacement for malloc.h which factors out platform differences.
3 #include <stdlib.h>
4 #if defined(VGO_darwin)
5 # include <malloc/malloc.h>
6 #else
7 # include <malloc.h>
8 #endif
10 #include <assert.h>
12 // Allocates a 16-aligned block. Asserts if the allocation fails.
13 __attribute__((unused))
14 static void* memalign16(size_t szB)
16 void* x;
17 #if defined(VGO_darwin)
18 // Darwin lacks memalign, but its malloc is always 16-aligned anyway.
19 x = malloc(szB);
20 #else
21 x = memalign(16, szB);
22 #endif
23 assert(x);
24 assert(0 == ((16-1) & (unsigned long)x));
25 return x;