fixed small errors in memheap

This commit is contained in:
Magnus Auvinen 2008-01-20 09:53:15 +00:00
parent 2d4824efd5
commit f63bcc8673
2 changed files with 4 additions and 4 deletions

View file

@ -39,12 +39,12 @@ static CHUNK *memheap_newchunk()
} }
/******************/ /******************/
static void *memheap_allocate_from_chunk(CHUNK *chunk, int size) static void *memheap_allocate_from_chunk(CHUNK *chunk, unsigned int size)
{ {
char *mem; char *mem;
/* check if we need can fit the allocation */ /* check if we need can fit the allocation */
if(chunk->current + size >= chunk->end) if(chunk->current + size > chunk->end)
return (void*)0x0; return (void*)0x0;
/* get memory and move the pointer forward */ /* get memory and move the pointer forward */
@ -81,7 +81,7 @@ void memheap_destroy(HEAP *heap)
} }
/* */ /* */
void *memheap_allocate(HEAP *heap, int size) void *memheap_allocate(HEAP *heap, unsigned int size)
{ {
char *mem; char *mem;

View file

@ -3,4 +3,4 @@
typedef struct HEAP_t HEAP; typedef struct HEAP_t HEAP;
HEAP *memheap_create(); HEAP *memheap_create();
void memheap_destroy(HEAP *heap); void memheap_destroy(HEAP *heap);
void *memheap_allocate(HEAP *heap, int size); void *memheap_allocate(HEAP *heap, unsigned int size);