From 8cd583d591aff4af8a3d2623a52f605f6addd47a Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 14 Jan 2005 18:40:33 +0000 Subject: [PATCH] Fixed a bug (Report from Greg King) git-svn-id: svn://svn.cc65.org/cc65/trunk@3367 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/o65.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ld65/o65.c b/src/ld65/o65.c index c6c90b428..d2385be5a 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -135,7 +135,6 @@ struct O65Option { }; /* A o65 relocation table */ -#define RELOC_BLOCKSIZE 4096 typedef struct O65RelocTab O65RelocTab; struct O65RelocTab { unsigned Size; /* Size of the table */ @@ -480,10 +479,12 @@ static void O65RelocPutByte (O65RelocTab* R, unsigned B) /* Do we have enough space in the buffer? */ if (R->Fill == R->Size) { /* We need to grow the buffer */ - unsigned char* NewBuf = xmalloc (R->Size + RELOC_BLOCKSIZE); + unsigned NewSize = (R->Size == 0)? 1024 : R->Size * 2; + unsigned char* NewBuf = xmalloc (NewSize); memcpy (NewBuf, R->Buf, R->Size); xfree (R->Buf); - R->Buf = NewBuf; + R->Size = NewSize; + R->Buf = NewBuf; } /* Put the byte into the buffer */ -- 2.39.5