diff --git a/src/engine/e_memheap.c b/src/engine/e_memheap.c index 6d1176311..a4b9bf370 100644 --- a/src/engine/e_memheap.c +++ b/src/engine/e_memheap.c @@ -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; /* check if we need can fit the allocation */ - if(chunk->current + size >= chunk->end) + if(chunk->current + size > chunk->end) return (void*)0x0; /* 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; diff --git a/src/engine/e_memheap.h b/src/engine/e_memheap.h index 83082046f..af3c0b299 100644 --- a/src/engine/e_memheap.h +++ b/src/engine/e_memheap.h @@ -3,4 +3,4 @@ typedef struct HEAP_t HEAP; HEAP *memheap_create(); void memheap_destroy(HEAP *heap); -void *memheap_allocate(HEAP *heap, int size); +void *memheap_allocate(HEAP *heap, unsigned int size);