From 5b0ad76cd97c07ce1e16a39c663be77a6d60ef2c Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 14 Jan 2005 18:52:30 +0000 Subject: [PATCH] Recoded the last change git-svn-id: svn://svn.cc65.org/cc65/trunk@3368 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ld65/o65.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ld65/o65.c b/src/ld65/o65.c index d2385be5a..49c024378 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -479,12 +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 NewSize = (R->Size == 0)? 1024 : R->Size * 2; - unsigned char* NewBuf = xmalloc (NewSize); - memcpy (NewBuf, R->Buf, R->Size); - xfree (R->Buf); - R->Size = NewSize; - R->Buf = NewBuf; + if (R->Size) { + R->Size *= 2; + } else { + R->Size = 1024; /* Initial size */ + } + R->Buf = xrealloc (R->Buf, R->Size); } /* Put the byte into the buffer */