From: uz Date: Tue, 10 Jul 2012 20:45:16 +0000 (+0000) Subject: Modifications for smaller code size. X-Git-Tag: V2.14~294 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7a0fa3ce6747e41a79dd606410bb9a6f01dfa8d1;p=cc65 Modifications for smaller code size. git-svn-id: svn://svn.cc65.org/cc65/trunk@5777 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/common/fputs.c b/libsrc/common/fputs.c index 3b07d8e4d..c4c87eaa3 100644 --- a/libsrc/common/fputs.c +++ b/libsrc/common/fputs.c @@ -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) { diff --git a/libsrc/common/realloc.c b/libsrc/common/realloc.c index f46d9a559..2bbc16d9f 100644 --- a/libsrc/common/realloc.c +++ b/libsrc/common/realloc.c @@ -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;