mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-24 17:22:55 +02:00
* changed reverseparameters() from function into procedure: it does not make
sense as a function (the original input needed to be replaced by its result to make any sense), and someone already mistakenly used it like that in htypechk causing a bug/memory leak git-svn-id: trunk@40729 -
This commit is contained in:
parent
9d079bfb97
commit
ff8ccb06e5
@ -521,7 +521,7 @@ implementation
|
|||||||
function tjvminlinenode.first_setlength: tnode;
|
function tjvminlinenode.first_setlength: tnode;
|
||||||
begin
|
begin
|
||||||
{ reverse the parameter order so we can process them more easily }
|
{ reverse the parameter order so we can process them more easily }
|
||||||
left:=reverseparameters(tcallparanode(left));
|
reverseparameters(tcallparanode(left));
|
||||||
{ treat setlength(x,0) specially: used to init uninitialised locations }
|
{ treat setlength(x,0) specially: used to init uninitialised locations }
|
||||||
if not is_shortstring(left.resultdef) and
|
if not is_shortstring(left.resultdef) and
|
||||||
not assigned(tcallparanode(tcallparanode(left).right).right) and
|
not assigned(tcallparanode(tcallparanode(left).right).right) and
|
||||||
@ -535,7 +535,7 @@ implementation
|
|||||||
{ strings are handled the same as on other platforms }
|
{ strings are handled the same as on other platforms }
|
||||||
if left.resultdef.typ=stringdef then
|
if left.resultdef.typ=stringdef then
|
||||||
begin
|
begin
|
||||||
left:=reverseparameters(tcallparanode(left));
|
reverseparameters(tcallparanode(left));
|
||||||
result:=inherited first_setlength;
|
result:=inherited first_setlength;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -292,7 +292,7 @@ interface
|
|||||||
dct_propput
|
dct_propput
|
||||||
);
|
);
|
||||||
|
|
||||||
function reverseparameters(p: tcallparanode): tcallparanode;
|
procedure reverseparameters(var p: tcallparanode);
|
||||||
function translate_disp_call(selfnode,parametersnode: tnode; calltype: tdispcalltype; const methodname : ansistring;
|
function translate_disp_call(selfnode,parametersnode: tnode; calltype: tdispcalltype; const methodname : ansistring;
|
||||||
dispid : longint;resultdef : tdef) : tnode;
|
dispid : longint;resultdef : tdef) : tnode;
|
||||||
|
|
||||||
@ -333,21 +333,23 @@ implementation
|
|||||||
HELPERS
|
HELPERS
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
|
|
||||||
function reverseparameters(p: tcallparanode): tcallparanode;
|
procedure reverseparameters(var p: tcallparanode);
|
||||||
var
|
var
|
||||||
|
tmpp,
|
||||||
hp1, hp2: tcallparanode;
|
hp1, hp2: tcallparanode;
|
||||||
begin
|
begin
|
||||||
hp1:=nil;
|
hp1:=nil;
|
||||||
while assigned(p) do
|
tmpp:=p;
|
||||||
|
while assigned(tmpp) do
|
||||||
begin
|
begin
|
||||||
{ pull out }
|
{ pull out }
|
||||||
hp2:=p;
|
hp2:=tmpp;
|
||||||
p:=tcallparanode(p.right);
|
tmpp:=tcallparanode(tmpp.right);
|
||||||
{ pull in }
|
{ pull in }
|
||||||
hp2.right:=hp1;
|
hp2.right:=hp1;
|
||||||
hp1:=hp2;
|
hp1:=hp2;
|
||||||
end;
|
end;
|
||||||
reverseparameters:=hp1;
|
p:=hp1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function translate_disp_call(selfnode,parametersnode: tnode; calltype: tdispcalltype; const methodname : ansistring;
|
function translate_disp_call(selfnode,parametersnode: tnode; calltype: tdispcalltype; const methodname : ansistring;
|
||||||
|
@ -1240,7 +1240,7 @@ implementation
|
|||||||
|
|
||||||
{ reverse the parameters (needed to get the colon parameters in the }
|
{ reverse the parameters (needed to get the colon parameters in the }
|
||||||
{ correct order when processing write(ln) }
|
{ correct order when processing write(ln) }
|
||||||
left := reverseparameters(tcallparanode(left));
|
reverseparameters(tcallparanode(left));
|
||||||
|
|
||||||
if is_rwstr then
|
if is_rwstr then
|
||||||
begin
|
begin
|
||||||
@ -1526,7 +1526,7 @@ implementation
|
|||||||
valsinttype:=search_system_type('VALSINT').typedef;
|
valsinttype:=search_system_type('VALSINT').typedef;
|
||||||
|
|
||||||
{ reverse parameters for easier processing }
|
{ reverse parameters for easier processing }
|
||||||
left := reverseparameters(tcallparanode(left));
|
reverseparameters(tcallparanode(left));
|
||||||
|
|
||||||
{ get the parameters }
|
{ get the parameters }
|
||||||
tempcode := nil;
|
tempcode := nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user