* Derefmap as dyn array

This commit is contained in:
Michaël Van Canneyt 2025-03-18 15:04:59 +01:00
parent 25e955b6e4
commit b09cdf35a5
2 changed files with 6 additions and 10 deletions

View File

@ -103,7 +103,7 @@ interface
{ modulename, used during ppu load } { modulename, used during ppu load }
modulename : pshortstring; modulename : pshortstring;
end; end;
pderefmap = ^tderefmaprec; tderefmaparray = array of tderefmaprec;
{ tmodule } { tmodule }
@ -141,7 +141,7 @@ interface
moduleid : longint; moduleid : longint;
unitmap : punitmap; { mapping of all used units } unitmap : punitmap; { mapping of all used units }
unitmapsize : longint; { number of units in the map } unitmapsize : longint; { number of units in the map }
derefmap : pderefmap; { mapping of all units needed for deref } derefmap : tderefmaparray; { mapping of all units needed for deref }
derefmapcnt : longint; { number of units in the map } derefmapcnt : longint; { number of units in the map }
derefmapsize : longint; { number of units in the map } derefmapsize : longint; { number of units in the map }
derefdataintflen : longint; derefdataintflen : longint;
@ -688,8 +688,8 @@ implementation
begin begin
for i:=0 to derefmapcnt-1 do for i:=0 to derefmapcnt-1 do
stringdispose(derefmap[i].modulename); stringdispose(derefmap[i].modulename);
freemem(derefmap);
end; end;
derefmap:=nil;
if assigned(_exports) then if assigned(_exports) then
_exports.free; _exports.free;
if assigned(dllscannerinputlist) then if assigned(dllscannerinputlist) then
@ -885,9 +885,8 @@ implementation
begin begin
for i:=0 to derefmapcnt-1 do for i:=0 to derefmapcnt-1 do
stringdispose(derefmap[i].modulename); stringdispose(derefmap[i].modulename);
freemem(derefmap);
derefmap:=nil;
end; end;
derefmap:=nil;
unitmapsize:=0; unitmapsize:=0;
derefmapsize:=0; derefmapsize:=0;
derefmapcnt:=0; derefmapcnt:=0;
@ -1156,9 +1155,7 @@ implementation
{ Extend Derefmap } { Extend Derefmap }
oldmapsize:=derefmapsize; oldmapsize:=derefmapsize;
derefmapsize:=loaded_units.count; derefmapsize:=loaded_units.count;
reallocmem(derefmap,derefmapsize*sizeof(tderefmaprec)); setlength(derefmap,derefmapsize);
fillchar(derefmap[oldmapsize],(derefmapsize-oldmapsize)*sizeof(tderefmaprec),0);
{ Add all units to unitmap } { Add all units to unitmap }
hp:=tmodule(loaded_units.first); hp:=tmodule(loaded_units.first);
i:=0; i:=0;

View File

@ -1369,8 +1369,7 @@ var
{ Load unit map used for resolving } { Load unit map used for resolving }
derefmapsize:=ppufile.getlongint; derefmapsize:=ppufile.getlongint;
derefmapcnt:=derefmapsize; derefmapcnt:=derefmapsize;
getmem(derefmap,derefmapsize*sizeof(tderefmaprec)); setlength(derefmap,derefmapsize);
fillchar(derefmap^,derefmapsize*sizeof(tderefmaprec),0);
for i:=0 to derefmapsize-1 do for i:=0 to derefmapsize-1 do
derefmap[i].modulename:=ppufile.getpshortstring; derefmap[i].modulename:=ppufile.getpshortstring;
end; end;