diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-16 12:09:56 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-05-16 12:38:21 +0200 |
commit | 502629707d8f28e2b1548ebdf03599612d7b6ef5 (patch) | |
tree | 553091f9bd23253f54ac6a0f607dace75718b0a2 /testsuites/libtests/malloctest | |
parent | Filesystem: Add missing include file <stdint.h> (diff) | |
download | rtems-502629707d8f28e2b1548ebdf03599612d7b6ef5.tar.bz2 |
libcsupport: Adjust malloc_walk() prototype
The header file <rtems/malloc.h> provides now also the malloc_walk()
prototype.
The malloc_walk() prototype reflects now the _Protected_heap_Walk() API.
The return status helps to print only in case of an error.
Diffstat (limited to 'testsuites/libtests/malloctest')
-rw-r--r-- | testsuites/libtests/malloctest/init.c | 12 | ||||
-rw-r--r-- | testsuites/libtests/malloctest/task1.c | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/testsuites/libtests/malloctest/init.c b/testsuites/libtests/malloctest/init.c index b81df2c1d9..a93edc41a6 100644 --- a/testsuites/libtests/malloctest/init.c +++ b/testsuites/libtests/malloctest/init.c @@ -34,10 +34,7 @@ #include <inttypes.h> #include <errno.h> #include <rtems/score/protectedheap.h> - -/* HACK: Blatant visibility violations */ -extern int malloc_info(Heap_Information_block *the_info); -extern void malloc_walk(size_t source, size_t printf_enabled); +#include <rtems/malloc.h> /* * A simple test of realloc @@ -47,6 +44,7 @@ static void test_realloc(void) void *p1, *p2, *p3, *p4; size_t i; int sc; + bool malloc_walk_ok; /* Test growing reallocation "in place" */ p1 = malloc(1); @@ -103,11 +101,13 @@ static void test_realloc(void) * Walk the C Program Heap */ puts( "malloc_walk - normal path" ); - malloc_walk( 1234, 0 ); + malloc_walk_ok = malloc_walk( 1234, false ); + rtems_test_assert( malloc_walk_ok ); puts( "malloc_walk - in critical section path" ); _Thread_Disable_dispatch(); - malloc_walk( 1234, 0 ); + malloc_walk_ok = malloc_walk( 1234, false ); + rtems_test_assert( malloc_walk_ok ); _Thread_Enable_dispatch(); /* diff --git a/testsuites/libtests/malloctest/task1.c b/testsuites/libtests/malloctest/task1.c index c042c8a010..1416ae12c6 100644 --- a/testsuites/libtests/malloctest/task1.c +++ b/testsuites/libtests/malloctest/task1.c @@ -20,9 +20,6 @@ #include <string.h> #include <stdlib.h> -/* HACK: Blatant visibility violation */ -extern void malloc_walk(size_t source, size_t printf_enabled); - #define NUM_PASSES 100 rtems_task Task_1_through_5( @@ -42,6 +39,8 @@ rtems_task Task_1_through_5( while (TRUE) { + bool malloc_walk_ok; + if ( passes++ > NUM_PASSES ) { puts("*** END OF MALLOC TEST ***"); rtems_test_exit(0); @@ -61,7 +60,8 @@ rtems_task Task_1_through_5( printf("mallocing %d bytes\n",mem_amt); memset( mem_ptr, mem_amt, mem_amt ); malloc_report_statistics(); - malloc_walk(1,FALSE); + malloc_walk_ok = malloc_walk( 1, false ); + rtems_test_assert( malloc_walk_ok ); status = rtems_task_wake_after( task_number( tid ) * 1 * rtems_clock_get_ticks_per_second()/4 ); for (i=0; i < mem_amt; i++) |