EXPORT void *malloc(size_t bytes);\r
EXPORT void *calloc(size_t bytes, size_t count);\r
EXPORT void free(void *mem);\r
EXPORT void *malloc(size_t bytes);\r
EXPORT void *calloc(size_t bytes, size_t count);\r
EXPORT void free(void *mem);\r
bestSize = bytes + sizeof(heap_head) + sizeof(heap_foot) + BLOCK_SIZE - 1;\r
bestSize = (bestSize/BLOCK_SIZE)*BLOCK_SIZE; //Round up to block size\r
\r
bestSize = bytes + sizeof(heap_head) + sizeof(heap_foot) + BLOCK_SIZE - 1;\r
bestSize = (bestSize/BLOCK_SIZE)*BLOCK_SIZE; //Round up to block size\r
\r
{\r
//_SysDebug(" malloc: curBlock = 0x%x, curBlock->magic = 0x%x\n", curBlock, curBlock->magic);\r
if(curBlock->magic == MAGIC_FREE)\r
{\r
//_SysDebug(" malloc: curBlock = 0x%x, curBlock->magic = 0x%x\n", curBlock, curBlock->magic);\r
if(curBlock->magic == MAGIC_FREE)\r
break;\r
if(bestSize < curBlock->size && (curBlock->size < closestMatch || closestMatch == 0)) {\r
closestMatch = curBlock->size;\r
break;\r
if(bestSize < curBlock->size && (curBlock->size < closestMatch || closestMatch == 0)) {\r
closestMatch = curBlock->size;\r
- if(_heap_end != _heap_start && ((heap_foot*)((Uint)_heap_end-sizeof(heap_foot)))->magic == MAGIC) {\r
- heap_head *tmpHead = ((heap_foot*)((Uint)_heap_end-sizeof(heap_foot)))->header;\r
+ if(_heap_end != _heap_start && ((heap_foot*)((uintptr_t)_heap_end-sizeof(heap_foot)))->magic == MAGIC) {\r
+ heap_head *tmpHead = ((heap_foot*)((uintptr_t)_heap_end-sizeof(heap_foot)))->header;\r
if(tmpHead->magic == MAGIC_FREE) {\r
tmpHead->size += bytes;\r
foot->header = tmpHead;\r
if(tmpHead->magic == MAGIC_FREE) {\r
tmpHead->size += bytes;\r
foot->header = tmpHead;\r
- if( (Uint)ptr < (Uint)_heap_start ) return 0;\r
- if( (Uint)ptr > (Uint)_heap_end ) return 0;\r
+ if( (uintptr_t)ptr < (uintptr_t)_heap_start ) return 0;\r
+ if( (uintptr_t)ptr > (uintptr_t)_heap_end ) return 0;\r
_SysDebug("brk: (newpos=0x%x)", newpos);\r
\r
// Find initial position\r
_SysDebug("brk: (newpos=0x%x)", newpos);\r
\r
// Find initial position\r