ftmemsim-valgrind/memcheck/tests/malloc_usable.c
Nicholas Nethercote 94ed569cdc Fix some more 'make check' warnings, ones that appear on non-Linux
platforms.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9238
2009-02-23 07:17:08 +00:00

21 lines
495 B
C

#include <assert.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
# if !defined(_AIX)
// Because Memcheck marks any slop as inaccessible, it doesn't round up
// sizes for malloc_usable_size().
int* x = malloc(99);
// XXX: would be better to have a HAVE_MALLOC_USABLE_SIZE variable here
assert(99 == malloc_usable_size(x));
assert( 0 == malloc_usable_size(NULL));
assert( 0 == malloc_usable_size((void*)0xdeadbeef));
# endif
return 0;
}