Browse Source

* Use dyn array of boolean for isHandled

Michaël Van Canneyt 4 months ago
parent
commit
0f2248f923
2 changed files with 9 additions and 13 deletions
  1. 1 0
      compiler/globtype.pas
  2. 8 13
      compiler/link.pas

+ 1 - 0
compiler/globtype.pas

@@ -43,6 +43,7 @@ interface
 
 
        TByteDynArray = array of byte;
        TByteDynArray = array of byte;
        TAnsiCharDynArray = array of ansichar;
        TAnsiCharDynArray = array of ansichar;
+       TBooleanDynArray = array of boolean;
 
 
        Int32 = Longint;
        Int32 = Longint;
 
 

+ 8 - 13
compiler/link.pas

@@ -129,7 +129,7 @@ interface
       protected
       protected
          linkscript : TCmdStrList;
          linkscript : TCmdStrList;
          ScriptCount : longint;
          ScriptCount : longint;
-         IsHandled : PBooleanArray;
+         IsHandled : TBooleanDynArray;
          property CArObjectReader:TObjectReaderClass read FCArObjectReader write FCArObjectReader;
          property CArObjectReader:TObjectReaderClass read FCArObjectReader write FCArObjectReader;
          property CObjInput:TObjInputClass read FCObjInput write FCObjInput;
          property CObjInput:TObjInputClass read FCObjInput write FCObjInput;
          property CExeOutput:TExeOutputClass read FCExeOutput write FCExeOutput;
          property CExeOutput:TExeOutputClass read FCExeOutput write FCExeOutput;
@@ -1548,7 +1548,6 @@ Implementation
         ImportLibraryList.Free;
         ImportLibraryList.Free;
         if assigned(IsHandled) then
         if assigned(IsHandled) then
           begin
           begin
-            FreeMem(IsHandled,sizeof(boolean)*ScriptCount);
             IsHandled:=nil;
             IsHandled:=nil;
             ScriptCount:=0;
             ScriptCount:=0;
           end;
           end;
@@ -1821,11 +1820,7 @@ Implementation
             hp:=TCmdStrListItem(hp.next);
             hp:=TCmdStrListItem(hp.next);
           end;
           end;
         ScriptCount:=i;
         ScriptCount:=i;
-        if ScriptCount>0 then
-          begin
-            GetMem(IsHandled,sizeof(boolean)*ScriptCount);
-            Fillchar(IsHandled^,sizeof(boolean)*ScriptCount,#0);
-          end;
+        SetLength(IsHandled,ScriptCount);
       end;
       end;
 
 
     procedure TInternalLinker.ParseScript_PostCheck;
     procedure TInternalLinker.ParseScript_PostCheck;
@@ -1838,7 +1833,7 @@ Implementation
         while assigned(hp) do
         while assigned(hp) do
           begin
           begin
             inc(i);
             inc(i);
-            if not IsHandled^[i] then
+            if not IsHandled[i] then
               begin
               begin
                 Comment(V_Warning,'"'+hp.str+
                 Comment(V_Warning,'"'+hp.str+
                   '" internal linker script not handled');
                   '" internal linker script not handled');
@@ -1877,7 +1872,7 @@ Implementation
             s:=hp.str;
             s:=hp.str;
             if (s='') or (s[1]='#') then
             if (s='') or (s[1]='#') then
               begin
               begin
-                IsHandled^[i]:=true;
+                IsHandled[i]:=true;
                 hp:=TCmdStrListItem(hp.next);
                 hp:=TCmdStrListItem(hp.next);
                 continue;
                 continue;
               end;
               end;
@@ -1907,7 +1902,7 @@ Implementation
             else
             else
               handled:=false;
               handled:=false;
             if handled then
             if handled then
-              IsHandled^[i]:=true;
+              IsHandled[i]:=true;
             hp:=TCmdStrListItem(hp.next);
             hp:=TCmdStrListItem(hp.next);
           end;
           end;
       end;
       end;
@@ -1961,7 +1956,7 @@ Implementation
             else
             else
               handled:=false;
               handled:=false;
             if handled then
             if handled then
-              IsHandled^[i]:=true;
+              IsHandled[i]:=true;
             hp:=TCmdStrListItem(hp.next);
             hp:=TCmdStrListItem(hp.next);
           end;
           end;
         exeoutput.Order_End;
         exeoutput.Order_End;
@@ -2001,7 +1996,7 @@ Implementation
             else
             else
               handled:=false;
               handled:=false;
             if handled then
             if handled then
-              IsHandled^[i]:=true;
+              IsHandled[i]:=true;
             hp:=TCmdStrListItem(hp.next);
             hp:=TCmdStrListItem(hp.next);
           end;
           end;
       end;
       end;
@@ -2042,7 +2037,7 @@ Implementation
             else
             else
               handled:=false;
               handled:=false;
             if handled then
             if handled then
-              IsHandled^[i]:=true;
+              IsHandled[i]:=true;
             hp:=TCmdStrListItem(hp.next);
             hp:=TCmdStrListItem(hp.next);
           end;
           end;
       end;
       end;