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:
@@ -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 */
|
/* 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) {
|
if ((f->f_flags & _FOPEN) == 0 || (f->f_flags & (_FERROR | _FEOF)) != 0) {
|
||||||
|
|||||||
@@ -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;
|
struct usedblock* newblock;
|
||||||
unsigned oldsize;
|
unsigned oldsize;
|
||||||
unsigned newhptr;
|
unsigned newhptr;
|
||||||
int diff;
|
|
||||||
|
|
||||||
/* Check the block parameter */
|
/* Check the block parameter */
|
||||||
if (!block) {
|
if (!block) {
|
||||||
@@ -74,13 +73,10 @@ void* __fastcall__ realloc (void* block, size_t size)
|
|||||||
b = (((struct usedblock*) block) - 1)->start;
|
b = (((struct usedblock*) block) - 1)->start;
|
||||||
oldsize = b->size;
|
oldsize = b->size;
|
||||||
|
|
||||||
/* Get the size difference as a signed quantity */
|
|
||||||
diff = size - oldsize;
|
|
||||||
|
|
||||||
/* Is the block at the current heap top? */
|
/* Is the block at the current heap top? */
|
||||||
if (((unsigned) b) + oldsize == ((unsigned) _heapptr)) {
|
if (((unsigned) b) + oldsize == ((unsigned) _heapptr)) {
|
||||||
/* Check if we've enough memory at the heap top */
|
/* Check if we've enough memory at the heap top */
|
||||||
newhptr = ((unsigned) _heapptr) + diff;
|
newhptr = ((unsigned) _heapptr) - oldsize + size;
|
||||||
if (newhptr <= ((unsigned) _heapend)) {
|
if (newhptr <= ((unsigned) _heapend)) {
|
||||||
/* Ok, there's space enough */
|
/* Ok, there's space enough */
|
||||||
_heapptr = (unsigned*) newhptr;
|
_heapptr = (unsigned*) newhptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user