Modifications for smaller code size.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5777 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-07-10 20:45:16 +00:00
parent baa978d7a4
commit 7a0fa3ce67
2 changed files with 4 additions and 8 deletions

View File

@ -13,7 +13,7 @@
int __fastcall__ fputs (const char* s, FILE* f)
int __fastcall__ fputs (const char* s, register FILE* f)
{
/* Check if the file is open or if there is an error condition */
if ((f->f_flags & _FOPEN) == 0 || (f->f_flags & (_FERROR | _FEOF)) != 0) {

View File

@ -39,13 +39,12 @@
void* __fastcall__ realloc (void* block, size_t size)
void* __fastcall__ realloc (void* block, register size_t size)
{
struct usedblock* b;
register struct usedblock* b;
struct usedblock* newblock;
unsigned oldsize;
unsigned newhptr;
int diff;
/* Check the block parameter */
if (!block) {
@ -74,13 +73,10 @@ void* __fastcall__ realloc (void* block, size_t size)
b = (((struct usedblock*) block) - 1)->start;
oldsize = b->size;
/* Get the size difference as a signed quantity */
diff = size - oldsize;
/* Is the block at the current heap top? */
if (((unsigned) b) + oldsize == ((unsigned) _heapptr)) {
/* Check if we've enough memory at the heap top */
newhptr = ((unsigned) _heapptr) + diff;
newhptr = ((unsigned) _heapptr) - oldsize + size;
if (newhptr <= ((unsigned) _heapend)) {
/* Ok, there's space enough */
_heapptr = (unsigned*) newhptr;