From 27744cc41fe6c5ef734715dc9f25bbc3010cc529 Mon Sep 17 00:00:00 2001 From: johanknol Date: Fri, 25 May 2001 08:41:22 +0000 Subject: [PATCH] update the buffer pointer after possible relocation in realloc() git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@853 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCC.lex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SDCC.lex b/src/SDCC.lex index 414d44a8..b6ff35a6 100644 --- a/src/SDCC.lex +++ b/src/SDCC.lex @@ -100,8 +100,10 @@ struct options save_options ; . { if (asmp-asmbuff >= asmbuffSize-2) { // increase the buffersize with 50% + int size=asmp-asmbuff; asmbuffSize=asmbuffSize*3/2; asmbuff = Safe_realloc (asmbuff, asmbuffSize); + asmp=asmbuff+size; } *asmp++ = yytext[0]; } @@ -109,8 +111,10 @@ struct options save_options ; count(); if (asmp-asmbuff >= asmbuffSize-3) { // increase the buffersize with 50% + int size=asmp-asmbuff; asmbuffSize=asmbuffSize*3/2; asmbuff = Safe_realloc (asmbuff, asmbuffSize); + asmp=asmbuff+size; } *asmp++ = '\n' ; } -- 2.30.2