Replace most returns with CHECK_ASSERTION

Also fix some Seek methods return types being unsigned, while returning
negative errors.

Added the CHECK_ASSERTION macro checks in a couple more places.

Simplified CHECK_ASSERTION macro usage.
This commit is contained in:
Raul Tambre 2015-11-08 13:42:41 +02:00
parent 9c2f48cd1d
commit 5d5a4f804b
14 changed files with 159 additions and 394 deletions

View file

@ -1,20 +1,10 @@
#pragma once
// Failure codes for the functions
enum
{
VM_SUCCESS = 0,
VM_FAILURE = -1,
};
namespace memory_helper
{
/**
* Reserve size bytes of virtual memory and returns it.
* The memory should be commited before usage.
*
* Returns the base address of the allocated region of pages, if successful.
* Returns (void*)VM_FAILURE, if unsuccessful.
*/
void* reserve_memory(size_t size);
@ -22,17 +12,11 @@ namespace memory_helper
* Commit page_size bytes of virtual memory starting at pointer.
* That is, bake reserved memory with physical memory.
* pointer should belong to a range of reserved memory.
*
* Returns VM_SUCCESS, if successful.
* Returns VM_FAILURE, if unsuccessful.
*/
s32 commit_page_memory(void* pointer, size_t page_size);
void commit_page_memory(void* pointer, size_t page_size);
/**
* Free memory alloced via reserve_memory.
*
* Returns VM_SUCCESS, if successful.
* Returns VM_FAILURE, if unsuccessful.
*/
s32 free_reserved_memory(void* pointer, size_t size);
void free_reserved_memory(void* pointer, size_t size);
}