diff options
author | Michael Brown | 2007-01-16 09:36:42 +0100 |
---|---|---|
committer | Michael Brown | 2007-01-16 09:36:42 +0100 |
commit | 544fa259287a2b919d8ed05bc201a5133032ef05 (patch) | |
tree | ff78f4abbfb22c10f45402f98c11e2d5419f5e70 /src/tests/umalloc_test.c | |
parent | Create and use async_block() macro; it cuts down on the visual overhead (diff) | |
download | ipxe-544fa259287a2b919d8ed05bc201a5133032ef05.tar.gz ipxe-544fa259287a2b919d8ed05bc201a5133032ef05.tar.xz ipxe-544fa259287a2b919d8ed05bc201a5133032ef05.zip |
Rename e{malloc,realloc,free} to u{malloc,realloc,free}, to more obviously
reflect the fact that they allocate and deallocate user memory (i.e.
things reached through a userptr_t).
Diffstat (limited to 'src/tests/umalloc_test.c')
-rw-r--r-- | src/tests/umalloc_test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/tests/umalloc_test.c b/src/tests/umalloc_test.c new file mode 100644 index 00000000..98de8784 --- /dev/null +++ b/src/tests/umalloc_test.c @@ -0,0 +1,26 @@ +#include <vsprintf.h> +#include <gpxe/uaccess.h> +#include <gpxe/umalloc.h> +#include <gpxe/memmap.h> + +void umalloc_test ( void ) { + struct memory_map memmap; + userptr_t bob; + userptr_t fred; + + printf ( "Before allocation:\n" ); + get_memmap ( &memmap ); + + bob = ymalloc ( 1234 ); + bob = yrealloc ( bob, 12345 ); + fred = ymalloc ( 999 ); + + printf ( "After allocation:\n" ); + get_memmap ( &memmap ); + + ufree ( bob ); + ufree ( fred ); + + printf ( "After freeing:\n" ); + get_memmap ( &memmap ); +} |