From f63bcc8673ddab0520faf34276dfa9141c609102 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 20 Jan 2008 09:53:15 +0000 Subject: [PATCH] fixed small errors in memheap --- src/engine/e_memheap.c | 6 +++--- src/engine/e_memheap.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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);