update the buffer pointer after possible relocation in realloc()
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 25 May 2001 08:41:22 +0000 (08:41 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 25 May 2001 08:41:22 +0000 (08:41 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@853 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCC.lex

index 414d44a88cf142e37cb32e009dcd8df04036f4ea..b6ff35a6c0d77eed72505ce71b3d22ded639ece6 100644 (file)
@@ -100,8 +100,10 @@ struct options  save_options  ;
 <asm>.         { 
   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' ;
 }