Bläddra i källkod

Merged revisions 3356 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/trunk

........
r3356 | marco | 2006-04-29 15:51:13 +0200 (Sat, 29 Apr 2006) | 1 line

* 5059 and minimal optimisation
........

git-svn-id: branches/fixes_2_0@3357 -

marco 19 år sedan
förälder
incheckning
a6f2ad347d
1 ändrade filer med 28 tillägg och 10 borttagningar
  1. 28 10
      fcl/xml/dom.pp

+ 28 - 10
fcl/xml/dom.pp

@@ -975,17 +975,35 @@ var
 begin
   Result := nil;
   child := node.FirstChild;
-  while Assigned(child) do
-  begin
-    if index = 0 then
+  If UseFilter Then
     begin
-      Result := child;
-      break;
-    end;
-    if (not UseFilter) or (child.NodeName = filter) then
-      Dec(index);
-    child := child.NextSibling;
-  end;
+      while Assigned(child) do
+        begin
+          if (child.nodename=filter) then
+            begin
+              if index=0 then
+                begin
+                  Result := child;
+                  break;
+                end;
+              dec(index);
+            end;
+          child := child.NextSibling;
+        end;
+    end
+  else
+    begin
+      while Assigned(child) do
+        begin
+          if index = 0 then
+            begin
+              Result := child;
+              break;
+            end;
+          Dec(index);
+          child := child.NextSibling;
+        end;
+    end
 end;