summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown2006-03-23 20:33:57 +0100
committerMichael Brown2006-03-23 20:33:57 +0100
commitaf23ff8a24a9de9b725335527529e5cc743311eb (patch)
tree5208732478b9f9f1793931ad56adf2e394b7d324 /src/core
parentAdded missing #endif (diff)
downloadipxe-af23ff8a24a9de9b725335527529e5cc743311eb.tar.gz
ipxe-af23ff8a24a9de9b725335527529e5cc743311eb.tar.xz
ipxe-af23ff8a24a9de9b725335527529e5cc743311eb.zip
Assertions are now handled via the POSIX-like <assert.h>.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/buffer.c5
-rw-r--r--src/core/heap.c11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/core/buffer.c b/src/core/buffer.c
index b1a0464ec..5c31ff8de 100644
--- a/src/core/buffer.c
+++ b/src/core/buffer.c
@@ -42,6 +42,7 @@
#include "string.h"
#include "io.h"
#include "errno.h"
+#include <assert.h>
#include "buffer.h"
/**
@@ -208,7 +209,7 @@ int fill_buffer ( struct buffer *buffer, const void *data,
/* Write back 'before' block, if any */
if ( before.start ) {
before.tail = 0;
- ASSERT ( ( before.end - before.start ) >=
+ assert ( ( before.end - before.start ) >=
sizeof ( struct buffer_free_block ) );
store_free_block ( &before );
} else {
@@ -217,7 +218,7 @@ int fill_buffer ( struct buffer *buffer, const void *data,
/* Write back 'after' block, if any */
if ( after.start < buffer->end ) {
- ASSERT ( after.tail ||
+ assert ( after.tail ||
( ( after.end - after.start ) >=
sizeof ( struct buffer_free_block ) ) );
store_free_block ( &after );
diff --git a/src/core/heap.c b/src/core/heap.c
index d9a7efec7..d70aa2d97 100644
--- a/src/core/heap.c
+++ b/src/core/heap.c
@@ -1,6 +1,7 @@
#include "etherboot.h"
#include "init.h"
#include "memsizes.h"
+#include <assert.h>
#include "heap.h"
struct heap_block {
@@ -76,7 +77,7 @@ static void init_heap ( void ) {
}
}
- ASSERT ( size != 0 );
+ assert ( size != 0 );
DBG ( "HEAP using region [%x,%x)\n", heap_start, heap_end );
heap_ptr = heap_end;
}
@@ -95,7 +96,7 @@ void * emalloc ( size_t size, unsigned int align ) {
struct heap_block *block;
physaddr_t addr;
- ASSERT ( ( align & ( align - 1 ) ) == 0 );
+ assert ( ( align & ( align - 1 ) ) == 0 );
addr = block_alloc_addr ( heap_ptr, size, align );
if ( addr < heap_start ) {
@@ -133,7 +134,7 @@ static inline physaddr_t block_free_addr ( size_t size ) {
void efree ( void *ptr ) {
struct heap_block *block;
- ASSERT ( ptr == phys_to_virt ( heap_ptr + sizeof ( size_t ) ) );
+ assert ( ptr == phys_to_virt ( heap_ptr + sizeof ( size_t ) ) );
block = ( struct heap_block * )
( ptr - offsetof ( struct heap_block, data ) );
@@ -142,7 +143,7 @@ void efree ( void *ptr ) {
DBG ( "HEAP freed %x [%x,%x)\n", virt_to_phys ( ptr ),
virt_to_phys ( block ), heap_ptr );
- ASSERT ( heap_ptr <= heap_end );
+ assert ( heap_ptr <= heap_end );
}
/*
@@ -199,7 +200,7 @@ void * erealloc ( void *ptr, size_t size ) {
* already checked that there was sufficient space.
*/
ptr = emalloc ( size, old_align );
- ASSERT ( ptr != NULL );
+ assert ( ptr != NULL );
return ptr;
}