2
0
Эх сурвалжийг харах

Remove outdated LowFrag lists code.

Martijn Laan 4 сар өмнө
parent
commit
9254dce05d

+ 5 - 4
Projects/Src/Compiler.CompressionHandler.pas

@@ -2,7 +2,7 @@ unit Compiler.CompressionHandler;
 
 {
   Inno Setup
-  Copyright (C) 1997-2024 Jordan Russell
+  Copyright (C) 1997-2025 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
@@ -12,13 +12,14 @@ unit Compiler.CompressionHandler;
 interface
 
 uses
+  Classes,
   SHA256, ChaCha20, Shared.Struct, Shared.Int64Em, Shared.FileClass, Compression.Base,
-  Compiler.StringLists, Compiler.SetupCompiler;
+  Compiler.SetupCompiler;
 
 type
   TCompressionHandler = class
   private
-    FCachedCompressors: TLowFragList;
+    FCachedCompressors: TList;
     FCompiler: TSetupCompiler;
     FCompressor: TCustomCompressor;
     FChunkBytesRead: Integer64;
@@ -69,7 +70,7 @@ begin
   inherited Create;
   FCompiler := ACompiler;
   FCurSlice := -1;
-  FCachedCompressors := TLowFragList.Create;
+  FCachedCompressors := TList.Create;
   NewSlice(InitialSliceFilename);
 end;
 

+ 30 - 30
Projects/Src/Compiler.SetupCompiler.pas

@@ -354,24 +354,24 @@ constructor TSetupCompiler.Create(AOwner: TComponent);
 begin
   inherited Create;
   ScriptFiles := TStringList.Create;
-  LanguageEntries := TLowFragList.Create;
-  CustomMessageEntries := TLowFragList.Create;
-  PermissionEntries := TLowFragList.Create;
-  TypeEntries := TLowFragList.Create;
-  ComponentEntries := TLowFragList.Create;
-  TaskEntries := TLowFragList.Create;
-  DirEntries := TLowFragList.Create;
-  FileEntries := TLowFragList.Create;
-  FileLocationEntries := TLowFragList.Create;
-  IconEntries := TLowFragList.Create;
-  IniEntries := TLowFragList.Create;
-  RegistryEntries := TLowFragList.Create;
-  InstallDeleteEntries := TLowFragList.Create;
-  UninstallDeleteEntries := TLowFragList.Create;
-  RunEntries := TLowFragList.Create;
-  UninstallRunEntries := TLowFragList.Create;
+  LanguageEntries := TList.Create;
+  CustomMessageEntries := TList.Create;
+  PermissionEntries := TList.Create;
+  TypeEntries := TList.Create;
+  ComponentEntries := TList.Create;
+  TaskEntries := TList.Create;
+  DirEntries := TList.Create;
+  FileEntries := TList.Create;
+  FileLocationEntries := TList.Create;
+  IconEntries := TList.Create;
+  IniEntries := TList.Create;
+  RegistryEntries := TList.Create;
+  InstallDeleteEntries := TList.Create;
+  UninstallDeleteEntries := TList.Create;
+  RunEntries := TList.Create;
+  UninstallRunEntries := TList.Create;
   FileLocationEntryFilenames := THashStringList.Create;
-  FileLocationEntryExtraInfos := TLowFragList.Create;
+  FileLocationEntryExtraInfos := TList.Create;
   WarningsList := THashStringList.Create;
   WarningsList.IgnoreDuplicates := True;
   ExpectedCustomMessageNames := TStringList.Create;
@@ -380,9 +380,9 @@ begin
   UsedUserAreas.Duplicates := dupIgnore;
   PreprocIncludedFilenames := TStringList.Create;
   DefaultLangData := TLangData.Create;
-  PreLangDataList := TLowFragList.Create;
-  LangDataList := TLowFragList.Create;
-  SignToolList := TLowFragList.Create;
+  PreLangDataList := TList.Create;
+  LangDataList := TList.Create;
+  SignToolList := TList.Create;
   SignTools := TStringList.Create;
   SignToolsParams := TStringList.Create;
   DebugInfo := TMemoryStream.Create;
@@ -816,7 +816,7 @@ var
   Data: PPreCompilerData;
   Filename: String;
   I: Integer;
-  Lines: TLowFragStringList;
+  Lines: TStringList;
   F: TTextFileReader;
   L: String;
 begin
@@ -837,7 +837,7 @@ begin
       Exit;
     end;
 
-  Lines := TLowFragStringList.Create;
+  Lines := TStringList.Create;
   try
     if FromPreProcessor then begin
       Data.Compiler.AddStatus(Format(SCompilerStatusReadingInFile, [Filename]));
@@ -878,12 +878,12 @@ function PreLineInProc(CompilerData: TPreprocCompilerData;
   FileHandle: TPreprocFileHandle; LineIndex: Integer): PChar; stdcall;
 var
   Data: PPreCompilerData;
-  Lines: TLowFragStringList;
+  Lines: TStringList;
 begin
   Data := CompilerData;
   if (FileHandle >= 0) and (FileHandle < Data.InFiles.Count) and
      (LineIndex >= 0) then begin
-    Lines := TLowFragStringList(Data.InFiles.Objects[FileHandle]);
+    Lines := TStringList(Data.InFiles.Objects[FileHandle]);
     if LineIndex < Lines.Count then begin
       Data.CurInLine := Lines[LineIndex];
       Result := PChar(Data.CurInLine);
@@ -960,12 +960,12 @@ end;
 function TSetupCompiler.ReadScriptFile(const Filename: String;
   const UseCache: Boolean; const AnsiConvertCodePage: Cardinal): TScriptFileLines;
 
-  function ReadMainScriptLines: TLowFragStringList;
+  function ReadMainScriptLines: TStringList;
   var
     Reset: Boolean;
     Data: TCompilerCallbackData;
   begin
-    Result := TLowFragStringList.Create;
+    Result := TStringList.Create;
     try
       Reset := True;
       while True do begin
@@ -983,7 +983,7 @@ function TSetupCompiler.ReadScriptFile(const Filename: String;
     end;
   end;
 
-  function SelectPreprocessor(const Lines: TLowFragStringList): TPreprocessScriptProc;
+  function SelectPreprocessor(const Lines: TStringList): TPreprocessScriptProc;
   var
     S: String;
   begin
@@ -1058,7 +1058,7 @@ function TSetupCompiler.ReadScriptFile(const Filename: String;
 
       ResultCode := ispePreprocessError;
       if FileLoaded then begin
-        PreProc := SelectPreprocessor(TLowFragStringList(Data.InFiles.Objects[0]));
+        PreProc := SelectPreprocessor(TStringList(Data.InFiles.Objects[0]));
         if Filename = '' then
           AddStatus(SCompilerStatusPreprocessing);
         ResultCode := PreProc(Params);
@@ -5320,8 +5320,8 @@ begin
         CheckCheckOrInstall(ParamCommonAfterInstall, AfterInstall, cikInstall);
       end;
 
-      FileList := TLowFragList.Create();
-      DirList := TLowFragList.Create();
+      FileList := TList.Create();
+      DirList := TList.Create();
       try
         if not ExternalFile then begin
           BuildFileList(PathExtractPath(SourceWildcard), '', PathExtractName(SourceWildcard), FileList, DirList, foCreateAllSubDirs in NewFileEntry.Options);

+ 4 - 89
Projects/Src/Compiler.StringLists.pas

@@ -2,11 +2,11 @@ unit Compiler.StringLists;
 
 {
   Inno Setup
-  Copyright (C) 1997-2024 Jordan Russell
+  Copyright (C) 1997-2025 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
-  Special string list classes used by TSetupCompiler and TCompressionHandler
+  Special string list classes used by TSetupCompiler
 }
 
 interface
@@ -15,26 +15,6 @@ uses
   Classes;
 
 type
-  TLowFragList = class(TList)
-  protected
-    procedure Grow; override;
-  end;
-
-  TLowFragStringList = class
-  private
-    FInternalList: TLowFragList;
-    function Get(Index: Integer): String;
-    function GetCount: Integer;
-    procedure Put(Index: Integer; const Value: String);
-  public
-    constructor Create;
-    destructor Destroy; override;
-    function Add(const S: String): Integer;
-    procedure Clear;
-    property Count: Integer read GetCount;
-    property Strings[Index: Integer]: String read Get write Put; default;
-  end;
-
   THashStringItem = record
     Hash: Longint;
     Str: String;
@@ -73,7 +53,7 @@ type
 
   TScriptFileLines = class
   private
-    FLines: TLowFragList;
+    FLines: TList;
     function Get(Index: Integer): PScriptFileLine;
     function GetCount: Integer;
     function GetText: String;
@@ -92,71 +72,6 @@ implementation
 uses
   PathFunc, Compression.Base;
 
-{ TLowFragList }
-
-procedure TLowFragList.Grow;
-var
-  Delta: Integer;
-begin
-  { Delphi 2's TList.Grow induces memory fragmentation big time. This is the
-    Grow code from Delphi 3 and later. }
-  if Capacity > 64 then Delta := Capacity div 4 else
-    if Capacity > 8 then Delta := 16 else
-      Delta := 4;
-  SetCapacity(Capacity + Delta);
-end;
-
-{ TLowFragStringList }
-
-constructor TLowFragStringList.Create;
-begin
-  inherited;
-  FInternalList := TLowFragList.Create;
-end;
-
-destructor TLowFragStringList.Destroy;
-begin
-  if Assigned(FInternalList) then begin
-    Clear;
-    FInternalList.Free;
-  end;
-  inherited;
-end;
-
-function TLowFragStringList.Add(const S: String): Integer;
-var
-  P: Pointer;
-begin
-  FInternalList.Expand;
-  P := nil;
-  String(P) := S;  { bump the ref count }
-  Result := FInternalList.Add(P);
-end;
-
-procedure TLowFragStringList.Clear;
-begin
-  if FInternalList.Count <> 0 then
-    Finalize(String(FInternalList.List[0]), FInternalList.Count);
-  FInternalList.Clear;
-end;
-
-function TLowFragStringList.Get(Index: Integer): String;
-begin
-  Result := String(FInternalList[Index]);
-end;
-
-function TLowFragStringList.GetCount: Integer;
-begin
-  Result := FInternalList.Count;
-end;
-
-procedure TLowFragStringList.Put(Index: Integer; const Value: String);
-begin
-  if (Index < 0) or (Index >= FInternalList.Count) then
-    raise EListError.CreateFmt('List index out of bounds (%d)', [Index]);
-  String(FInternalList.List[Index]) := Value;
-end;
-
 { THashStringList }
 
 destructor THashStringList.Destroy;
@@ -236,7 +151,7 @@ end;
 constructor TScriptFileLines.Create;
 begin
   inherited;
-  FLines := TLowFragList.Create;
+  FLines := TList.Create;
 end;
 
 destructor TScriptFileLines.Destroy;