From f1899978ae95400f805114e80f4f0c1897faa404 Mon Sep 17 00:00:00 2001 From: juha Date: Sun, 1 Jan 2012 15:05:00 +0000 Subject: [PATCH] TreeFilterEdit: minor optimization git-svn-id: trunk@34532 - --- components/lazcontrols/treefilteredit.pas | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/components/lazcontrols/treefilteredit.pas b/components/lazcontrols/treefilteredit.pas index 3f123b6a1e..1bec790fe9 100644 --- a/components/lazcontrols/treefilteredit.pas +++ b/components/lazcontrols/treefilteredit.pas @@ -402,23 +402,21 @@ end; function TTreeFilterEdit.GetBranch(ARootNode: TTreeNode): TBranch; // Get a new or existing branch for a node. var - branch: TBranch; i: Integer; begin if not Assigned(fBranches) then fBranches := TBranchList.Create; - branch := Nil; + Result := Nil; for i := 0 to fBranches.Count-1 do if fBranches[i].fRootNode = ARootNode then begin - branch := fBranches[i]; - branch.fOriginalData.Clear; + Result := fBranches[i]; + Result.fOriginalData.Clear; Break; end; - if branch = Nil then begin - branch := TBranch.Create(Self, ARootNode); - fBranches.Add(branch); + if Result = Nil then begin + Result := TBranch.Create(Self, ARootNode); + fBranches.Add(Result); end; - Result := branch; end; procedure TTreeFilterEdit.MoveNext;