mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 22:09:32 +02:00
* Remove usage of HasKey (bug ID 29820
git-svn-id: trunk@33226 -
This commit is contained in:
parent
ebc5a637fa
commit
18296c258f
@ -1956,13 +1956,7 @@ end;
|
|||||||
|
|
||||||
Function THTCustomNode.HasKey(const AKey: string): boolean;
|
Function THTCustomNode.HasKey(const AKey: string): boolean;
|
||||||
begin
|
begin
|
||||||
if Length(AKey) <> Length(FKey) then
|
Result:=(AKey=FKey);
|
||||||
begin
|
|
||||||
Result:=false;
|
|
||||||
Exit;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result:=CompareMem(PChar(FKey), PChar(AKey), Length(AKey));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TFPCustomHashTable }
|
{ TFPCustomHashTable }
|
||||||
@ -2070,11 +2064,8 @@ begin
|
|||||||
if Assigned(chn) then
|
if Assigned(chn) then
|
||||||
if chn.count>0 then
|
if chn.count>0 then
|
||||||
for i:=0 to chn.Count - 1 do
|
for i:=0 to chn.Count - 1 do
|
||||||
if THTCustomNode(chn[i]).HasKey(aKey) then
|
if THTCustomNode(chn[i]).Key=aKey then
|
||||||
begin
|
Exit(THTCustomNode(chn[i]));
|
||||||
Result:=THTCustomNode(chn[i]);
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2089,7 +2080,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Result.count>0 then
|
if Result.count>0 then
|
||||||
for i:=0 to Result.Count - 1 do
|
for i:=0 to Result.Count - 1 do
|
||||||
if THTCustomNode(Result[i]).HasKey(aKey) then
|
if (THTCustomNode(Result[i]).Key=aKey) then
|
||||||
raise EDuplicate.CreateFmt(DuplicateMsg, [aKey]);
|
raise EDuplicate.CreateFmt(DuplicateMsg, [aKey]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -2112,7 +2103,7 @@ begin
|
|||||||
if Assigned(chn) then
|
if Assigned(chn) then
|
||||||
if chn.count>0 then
|
if chn.count>0 then
|
||||||
for i:=0 to chn.Count - 1 do
|
for i:=0 to chn.Count - 1 do
|
||||||
if THTCustomNode(chn[i]).HasKey(aKey) then
|
if THTCustomNode(chn[i]).Key=aKey then
|
||||||
begin
|
begin
|
||||||
chn.Delete(i);
|
chn.Delete(i);
|
||||||
dec(FCount);
|
dec(FCount);
|
||||||
@ -2176,11 +2167,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if chn.count>0 then
|
if chn.count>0 then
|
||||||
for i:=0 to chn.Count - 1 do
|
for i:=0 to chn.Count - 1 do
|
||||||
if THTCustomNode(chn[i]).HasKey(aKey) then
|
if (THTCustomNode(chn[i]).Key=aKey) then
|
||||||
begin
|
Exit(THTNode(chn[i]));
|
||||||
Result:=THTNode(chn[i]);
|
|
||||||
Exit;
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user