mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed small errors in memheap
This commit is contained in:
parent
2d4824efd5
commit
f63bcc8673
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue