X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=device%2Flib%2Fpic16%2Flibc%2Fstdlib%2Fmalloc.c;fp=device%2Flib%2Fpic16%2Flibc%2Fstdlib%2Fmalloc.c;h=8a9847629a98bbce7fd7a7e5f3943287d9385b57;hb=26ca26f89a9800d7e0baf3d2747c324188bbd662;hp=7c0a48a0897a4ea5170a4726429a4d8aec0a4603;hpb=3ff37af7ef2f201529e1aa9ac5d473730a2bcb53;p=fw%2Fsdcc diff --git a/device/lib/pic16/libc/stdlib/malloc.c b/device/lib/pic16/libc/stdlib/malloc.c index 7c0a48a0..8a984762 100644 --- a/device/lib/pic16/libc/stdlib/malloc.c +++ b/device/lib/pic16/libc/stdlib/malloc.c @@ -7,19 +7,19 @@ #include "malloc.h" -extern unsigned char *_dynamicHeap; /* pointer to heap */ +extern unsigned char _MALLOC_SPEC *_dynamicHeap; /* pointer to heap */ -unsigned char *malloc(unsigned char len) +unsigned char _MALLOC_SPEC *malloc(unsigned char len) { - _malloc_rec *pHeap; /* pointer to block header */ - _malloc_rec *temp; + _malloc_rec _MALLOC_SPEC *pHeap; /* pointer to block header */ + _malloc_rec _MALLOC_SPEC *temp; unsigned char bLen; /* size of block */ unsigned char eLen; if(len > _MAX_HEAP_SIZE) - return ((unsigned char *)0); + return ((unsigned char _MALLOC_SPEC *)0); - pHeap = (_malloc_rec *)&_dynamicHeap; + pHeap = (_malloc_rec _MALLOC_SPEC *)&_dynamicHeap; while(1) { @@ -27,7 +27,7 @@ unsigned char *malloc(unsigned char len) /* if datum is zero, then last block, return NULL */ if(pHeap->datum == 0) - return ((unsigned char *)0); + return ((unsigned char _MALLOC_SPEC *)0); /* if current block is allocated then proceed to next */ if(pHeap->bits.alloc) { @@ -89,6 +89,6 @@ unsigned char *malloc(unsigned char len) temp->bits.alloc = 0; } - return ((unsigned char *)pHeap + 1); + return ((unsigned char _MALLOC_SPEC *)pHeap + 1); } }