lists, use builtin dup deletion method

This commit is contained in:
Basile Burg 2016-09-16 21:30:45 +02:00
parent 57ef887aad
commit acebde858c
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
4 changed files with 8 additions and 24 deletions

View File

@ -265,11 +265,6 @@ type
*) *)
function isStringDisabled(const str: string): boolean; function isStringDisabled(const str: string): boolean;
(**
* Deletes the duplicates in a TStrings instance.
*)
procedure deleteDups(str: TStrings);
(** (**
* Indicates wether str is only made of blank characters * Indicates wether str is only made of blank characters
*) *)
@ -1176,19 +1171,6 @@ begin
result := true; result := true;
end; end;
procedure deleteDups(str: TStrings);
var
i: integer;
begin
{$PUSH}{$HINTS OFF}
if str = nil then exit;
for i:= str.Count-1 downto 0 do
// if less than 0 -> not found -> unsigned -> greater than current index.
if cardinal(str.IndexOf(str[i])) < i then
str.Delete(i);
{$POP}
end;
function isBlank(const str: string): boolean; function isBlank(const str: string): boolean;
var var
c: char; c: char;

View File

@ -274,6 +274,10 @@ begin
fConfigs := TStringList.Create; fConfigs := TStringList.Create;
fSrcs := TStringList.Create; fSrcs := TStringList.Create;
fImportPaths := TStringList.Create; fImportPaths := TStringList.Create;
fSrcs.Duplicates:=TDuplicates.dupIgnore;
fImportPaths.Duplicates:=TDuplicates.dupIgnore;
fConfigs.Duplicates:=TDuplicates.dupIgnore;
fBuildTypes.Duplicates:=TDuplicates.dupIgnore;
// //
subjProjNew(fProjectSubject, self); subjProjNew(fProjectSubject, self);
subjProjChanged(fProjectSubject, self); subjProjChanged(fProjectSubject, self);
@ -844,7 +848,6 @@ begin
tryAddRelOrAbsFile(arr.Strings[i]); tryAddRelOrAbsFile(arr.Strings[i]);
end; end;
end; end;
deleteDups(fSrcs);
// exclusions // exclusions
lst.Clear; lst.Clear;
getExclusion(fJSON); getExclusion(fJSON);

View File

@ -2608,6 +2608,7 @@ begin
ldc: dmdProc.Executable :='ldmd2' + exeExt; ldc: dmdProc.Executable :='ldmd2' + exeExt;
gdc: dmdProc.Executable :='gdmd' + exeExt; gdc: dmdProc.Executable :='gdmd' + exeExt;
end; end;
TStringList(dmdproc.Parameters).Duplicates:=TDuplicates.dupIgnore;
dmdproc.Parameters.Add(fDoc.fileName); dmdproc.Parameters.Add(fDoc.fileName);
if not asObj then if not asObj then
dmdproc.Parameters.Add('-of' + fname + exeExt) dmdproc.Parameters.Add('-of' + fname + exeExt)
@ -2645,8 +2646,6 @@ begin
LibMan.getLibFiles(nil, dmdproc.Parameters); LibMan.getLibFiles(nil, dmdproc.Parameters);
LibMan.getLibSourcePath(nil, dmdproc.Parameters); LibMan.getLibSourcePath(nil, dmdproc.Parameters);
end; end;
deleteDups(dmdproc.Parameters);
dmdproc.Execute; dmdproc.Execute;
while dmdproc.Running do while dmdproc.Running do
application.ProcessMessages; application.ProcessMessages;

View File

@ -37,7 +37,7 @@ type
fRunnerOldCwd: string; fRunnerOldCwd: string;
fLibAliases: TStringList; fLibAliases: TStringList;
fConfigs: TCollection; fConfigs: TCollection;
fSrcs, fSrcsCop: TStringList; fSrcs: TStringList;
fConfIx: Integer; fConfIx: Integer;
fUpdateCount: NativeInt; fUpdateCount: NativeInt;
fProjectSubject: TCEProjectSubject; fProjectSubject: TCEProjectSubject;
@ -151,9 +151,10 @@ begin
fProjectSubject := TCEProjectSubject.create; fProjectSubject := TCEProjectSubject.create;
// //
fLibAliases := TStringList.Create; fLibAliases := TStringList.Create;
fLibAliases.Duplicates:=TDuplicates.dupIgnore;
fSrcs := TStringList.Create; fSrcs := TStringList.Create;
fSrcs.Duplicates:=TDuplicates.dupIgnore;
fSrcs.OnChange := @subMemberChanged; fSrcs.OnChange := @subMemberChanged;
fSrcsCop := TStringList.Create;
fConfigs := TCollection.create(TCompilerConfiguration); fConfigs := TCollection.create(TCompilerConfiguration);
// //
reset; reset;
@ -177,7 +178,6 @@ begin
fOnChange := nil; fOnChange := nil;
fLibAliases.Free; fLibAliases.Free;
fSrcs.free; fSrcs.free;
fSrcsCop.Free;
fConfigs.free; fConfigs.free;
killProcess(fRunner); killProcess(fRunner);
inherited; inherited;