* Fix preprocwrite code

This commit is contained in:
Michaël Van Canneyt 2025-03-18 16:16:52 +01:00
parent 16d8d46691
commit db7abc11d6
2 changed files with 7 additions and 6 deletions

View File

@ -325,7 +325,8 @@ implementation
set_current_module(tppumodule.create(nil,'',filename,false));
macrosymtablestack:=TSymtablestack.create;
current_scanner:=tscannerfile.Create(filename);
set_current_scanner(tscannerfile.Create(filename));
current_scanner.firstfile;
current_module.scanner:=current_scanner;
@ -387,7 +388,7 @@ implementation
until false;
{ free scanner }
current_scanner.destroy;
current_scanner:=nil;
set_current_scanner(nil);
{ close }
preprocfile.destroy;
end;

View File

@ -270,7 +270,7 @@ interface
{$ifdef PREPROCWRITE}
tpreprocfile=class
f : text;
buf : pointer;
buf : TByteDynArray;
spacefound,
eolfound : boolean;
constructor create(const fn:string);
@ -2920,8 +2920,8 @@ type
{$pop}
if ioresult<>0 then
Comment(V_Fatal,'can''t create file '+fn);
getmem(buf,preprocbufsize);
settextbuf(f,buf^,preprocbufsize);
setlength(buf,preprocbufsize);
settextbuf(f,buf[0],preprocbufsize);
{ reset }
eolfound:=false;
spacefound:=false;
@ -2931,7 +2931,7 @@ type
destructor tpreprocfile.destroy;
begin
close(f);
freemem(buf,preprocbufsize);
buf:=nil;
end;