From: johanknol Date: Fri, 19 Oct 2001 11:01:33 +0000 (+0000) Subject: should also work in --model-small now X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=31c536375bbc2a259fac507970500534d606b16a;p=fw%2Fsdcc should also work in --model-small now git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1417 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/lib/malloc.c b/device/lib/malloc.c index 18987901..c5aabbb5 100644 --- a/device/lib/malloc.c +++ b/device/lib/malloc.c @@ -19,7 +19,7 @@ MEMHEADER xdata * next; MEMHEADER xdata * prev; unsigned int len; - unsigned char mem[1]; + unsigned char mem; }; #define HEADER_SIZE (sizeof(MEMHEADER)-1) @@ -90,7 +90,7 @@ if (!current_header->len) { //This code works only for first_header in the list and only current_header->len = size; //for first allocation - return (current_header->mem); + return ((xdata *)&(current_header->mem)); } //else create new header at the begin of spare new_header = (MEMHEADER xdata * )((char xdata *)current_header + current_header->len); new_header->next = current_header->next; //and plug it into the chain @@ -98,7 +98,7 @@ current_header->next = new_header; if (new_header->next) new_header->next->prev = new_header; new_header->len = size; //mark as used - return (new_header->mem); + return ((xdata *)&(new_header->mem)); } void free (MEMHEADER xdata * p)