mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 02:09:43 +02:00
* fixed memory leak with options, you must use StopOptions instead of
Stop * fixed memory leak with forward resolving, make_ref is now false
This commit is contained in:
parent
c775ade1d6
commit
895c8b9efc
@ -83,6 +83,7 @@ const
|
|||||||
page_size = 24;
|
page_size = 24;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
option : poption;
|
||||||
read_configfile, { read config file, set when a cfgfile is found }
|
read_configfile, { read config file, set when a cfgfile is found }
|
||||||
target_is_set : boolean; { do not allow contradictory target settings }
|
target_is_set : boolean; { do not allow contradictory target settings }
|
||||||
asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
|
asm_is_set : boolean; { -T also change initoutputformat if not set idrectly }
|
||||||
@ -159,6 +160,18 @@ end;
|
|||||||
Toption
|
Toption
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
|
procedure StopOptions;
|
||||||
|
begin
|
||||||
|
if assigned(Option) then
|
||||||
|
begin
|
||||||
|
dispose(Option,Done);
|
||||||
|
Option:=nil;
|
||||||
|
end;
|
||||||
|
DoneVerbose;
|
||||||
|
Stop;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure Toption.WriteLogo;
|
procedure Toption.WriteLogo;
|
||||||
var
|
var
|
||||||
i : tmsgconst;
|
i : tmsgconst;
|
||||||
@ -176,7 +189,7 @@ begin
|
|||||||
MaybeLoadMessageFile;
|
MaybeLoadMessageFile;
|
||||||
for i:=option_info_start to option_info_end do
|
for i:=option_info_start to option_info_end do
|
||||||
Message(i);
|
Message(i);
|
||||||
Stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -283,7 +296,7 @@ begin
|
|||||||
write('*** press enter ***');
|
write('*** press enter ***');
|
||||||
readln(input);
|
readln(input);
|
||||||
if upper(input)='Q' then
|
if upper(input)='Q' then
|
||||||
stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
lines:=0;
|
lines:=0;
|
||||||
end;
|
end;
|
||||||
@ -292,7 +305,7 @@ begin
|
|||||||
inc(Lines);
|
inc(Lines);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -302,7 +315,7 @@ begin
|
|||||||
Write(s+#10)
|
Write(s+#10)
|
||||||
else
|
else
|
||||||
Writeln(s);
|
Writeln(s);
|
||||||
Stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -310,7 +323,7 @@ procedure Toption.IllegalPara(const opt:string);
|
|||||||
begin
|
begin
|
||||||
Message1(option_illegal_para,opt);
|
Message1(option_illegal_para,opt);
|
||||||
Message(option_help_pages_para);
|
Message(option_help_pages_para);
|
||||||
stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -530,10 +543,10 @@ begin
|
|||||||
Delete(more,1,1);
|
Delete(more,1,1);
|
||||||
case c of
|
case c of
|
||||||
'D' : begin
|
'D' : begin
|
||||||
if not ispara then
|
if not ispara then
|
||||||
DefaultReplacements(More);
|
DefaultReplacements(More);
|
||||||
utilsdirectory:=FixPath(More,true);
|
utilsdirectory:=FixPath(More,true);
|
||||||
end;
|
end;
|
||||||
'e' : SetRedirectFile(More);
|
'e' : SetRedirectFile(More);
|
||||||
'E' : OutputExeDir:=FixPath(More,true);
|
'E' : OutputExeDir:=FixPath(More,true);
|
||||||
'i' : if ispara then
|
'i' : if ispara then
|
||||||
@ -813,7 +826,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
'@' : begin
|
'@' : begin
|
||||||
Message(option_no_nested_response_file);
|
Message(option_no_nested_response_file);
|
||||||
Stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -904,7 +917,7 @@ begin
|
|||||||
if Level>=maxlevel then
|
if Level>=maxlevel then
|
||||||
begin
|
begin
|
||||||
Message(option_too_many_ifdef);
|
Message(option_too_many_ifdef);
|
||||||
stop;
|
stopOptions;
|
||||||
end;
|
end;
|
||||||
inc(Level);
|
inc(Level);
|
||||||
skip[level]:=(skip[level-1] or (not check_symbol(upper(GetName(opts)))));
|
skip[level]:=(skip[level-1] or (not check_symbol(upper(GetName(opts)))));
|
||||||
@ -916,7 +929,7 @@ begin
|
|||||||
if Level>=maxlevel then
|
if Level>=maxlevel then
|
||||||
begin
|
begin
|
||||||
Message(option_too_many_ifdef);
|
Message(option_too_many_ifdef);
|
||||||
stop;
|
stopOptions;
|
||||||
end;
|
end;
|
||||||
inc(Level);
|
inc(Level);
|
||||||
skip[level]:=(skip[level-1] or (check_symbol(upper(GetName(opts)))));
|
skip[level]:=(skip[level-1] or (check_symbol(upper(GetName(opts)))));
|
||||||
@ -931,7 +944,7 @@ begin
|
|||||||
if Level=0 then
|
if Level=0 then
|
||||||
begin
|
begin
|
||||||
Message(option_too_many_endif);
|
Message(option_too_many_endif);
|
||||||
stop;
|
stopOptions;
|
||||||
end;
|
end;
|
||||||
dec(level);
|
dec(level);
|
||||||
end
|
end
|
||||||
@ -1119,7 +1132,6 @@ end;
|
|||||||
procedure read_arguments(cmd:string);
|
procedure read_arguments(cmd:string);
|
||||||
var
|
var
|
||||||
configpath : pathstr;
|
configpath : pathstr;
|
||||||
option : poption;
|
|
||||||
begin
|
begin
|
||||||
{$ifdef Delphi}
|
{$ifdef Delphi}
|
||||||
option:=new(poption386,Init);
|
option:=new(poption386,Init);
|
||||||
@ -1286,7 +1298,7 @@ begin
|
|||||||
|
|
||||||
{ Stop if errors in options }
|
{ Stop if errors in options }
|
||||||
if ErrorCount>0 then
|
if ErrorCount>0 then
|
||||||
Stop;
|
StopOptions;
|
||||||
|
|
||||||
{ write logo if set }
|
{ write logo if set }
|
||||||
if option^.DoWriteLogo then
|
if option^.DoWriteLogo then
|
||||||
@ -1296,7 +1308,7 @@ begin
|
|||||||
if param_file='' then
|
if param_file='' then
|
||||||
begin
|
begin
|
||||||
Message(option_no_source_found);
|
Message(option_no_source_found);
|
||||||
Stop;
|
StopOptions;
|
||||||
end;
|
end;
|
||||||
{$ifndef linux}
|
{$ifndef linux}
|
||||||
param_file:=FixFileName(param_file);
|
param_file:=FixFileName(param_file);
|
||||||
@ -1358,13 +1370,19 @@ begin
|
|||||||
MaybeLoadMessageFile;
|
MaybeLoadMessageFile;
|
||||||
|
|
||||||
dispose(option,Done);
|
dispose(option,Done);
|
||||||
|
Option:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.48 2000-01-07 22:22:02 marco
|
Revision 1.49 2000-01-10 11:14:19 peter
|
||||||
|
* fixed memory leak with options, you must use StopOptions instead of
|
||||||
|
Stop
|
||||||
|
* fixed memory leak with forward resolving, make_ref is now false
|
||||||
|
|
||||||
|
Revision 1.48 2000/01/07 22:22:02 marco
|
||||||
* Added $target support for -FD
|
* Added $target support for -FD
|
||||||
|
|
||||||
Revision 1.47 2000/01/07 01:14:27 peter
|
Revision 1.47 2000/01/07 01:14:27 peter
|
||||||
|
@ -899,7 +899,9 @@ unit pdecl;
|
|||||||
stpos:=tokenpos;
|
stpos:=tokenpos;
|
||||||
tokenpos:=pforwarddef(hpd)^.forwardpos;
|
tokenpos:=pforwarddef(hpd)^.forwardpos;
|
||||||
resolving_forward:=true;
|
resolving_forward:=true;
|
||||||
|
make_ref:=false;
|
||||||
getsym(pforwarddef(hpd)^.tosymname,false);
|
getsym(pforwarddef(hpd)^.tosymname,false);
|
||||||
|
make_ref:=true;
|
||||||
resolving_forward:=false;
|
resolving_forward:=false;
|
||||||
tokenpos:=stpos;
|
tokenpos:=stpos;
|
||||||
{ we don't need the forwarddef anymore, dispose it }
|
{ we don't need the forwarddef anymore, dispose it }
|
||||||
@ -1180,7 +1182,12 @@ unit pdecl;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.176 2000-01-07 01:14:28 peter
|
Revision 1.177 2000-01-10 11:14:19 peter
|
||||||
|
* fixed memory leak with options, you must use StopOptions instead of
|
||||||
|
Stop
|
||||||
|
* fixed memory leak with forward resolving, make_ref is now false
|
||||||
|
|
||||||
|
Revision 1.176 2000/01/07 01:14:28 peter
|
||||||
* updated copyright to 2000
|
* updated copyright to 2000
|
||||||
|
|
||||||
Revision 1.175 1999/12/10 10:04:21 peter
|
Revision 1.175 1999/12/10 10:04:21 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user