Author: atsushi
Date: 2006-02-21 16:00:20 -0500 (Tue, 21 Feb 2006)
New Revision: 57109

Modified:
   trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
Log:
2006-02-21  Atsushi Enomoto <[EMAIL PROTECTED]>

        * DTMXPathNavigator2.cs : removed valueBuilder field (create 
          StringBuilder dynamically).



Modified: trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog 2006-02-21 20:59:25 UTC 
(rev 57108)
+++ trunk/mcs/class/System.XML/Mono.Xml.XPath/ChangeLog 2006-02-21 21:00:20 UTC 
(rev 57109)
@@ -1,3 +1,8 @@
+2006-02-21  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * DTMXPathNavigator2.cs : removed valueBuilder field (create 
+         StringBuilder dynamically).
+
 2006-02-16  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * DTMXPathDocument2.cs, DTMXPathNavigator2.cs :

Modified: trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs     
2006-02-21 20:59:25 UTC (rev 57108)
+++ trunk/mcs/class/System.XML/Mono.Xml.XPath/DTMXPathNavigator2.cs     
2006-02-21 21:00:20 UTC (rev 57109)
@@ -97,8 +97,6 @@
                int currentAttr;
                int currentNs;
 
-               StringBuilder valueBuilder;
-
 #region Properties
 
                public override string BaseURI {
@@ -219,34 +217,36 @@
                                if (iter == 0)
                                        return String.Empty;
 
-                               if (valueBuilder == null)
-                                       valueBuilder = new StringBuilder ();
-                               else
-                                       valueBuilder.Length = 0;
+                               StringBuilder builder = null;
+                               BuildValue (iter, ref builder);
+                               return builder == null ? String.Empty : 
builder.ToString ();
+                       }
+               }
 
-                               int end = nodes [currentNode].NextSibling;
-                               if (end == 0) {
-                                       int tmp = currentNode;
-                                       do {
-                                               tmp = nodes [tmp].Parent;
-                                               end = nodes [tmp].NextSibling;
-                                       } while (end == 0 && tmp != 0);
-                                       if (end == 0)
-                                               end = nodes.Length;
-                               }
+               void BuildValue (int iter, ref StringBuilder valueBuilder)
+               {
+                       int end = nodes [currentNode].NextSibling;
+                       if (end == 0) {
+                               int tmp = currentNode;
+                               do {
+                                       tmp = nodes [tmp].Parent;
+                                       end = nodes [tmp].NextSibling;
+                               } while (end == 0 && tmp != 0);
+                               if (end == 0)
+                                       end = nodes.Length;
+                       }
 
-                               while (iter < end) {
-                                       switch (nodes [iter].NodeType) {
-                                       case XPathNodeType.Text:
-                                       case 
XPathNodeType.SignificantWhitespace:
-                                       case XPathNodeType.Whitespace:
-                                               valueBuilder.Append 
(nonAtomicStringPool [nodes [iter].Value]);
-                                               break;
-                                       }
-                                       iter++;
+                       while (iter < end) {
+                               switch (nodes [iter].NodeType) {
+                               case XPathNodeType.Text:
+                               case XPathNodeType.SignificantWhitespace:
+                               case XPathNodeType.Whitespace:
+                                       if (valueBuilder == null)
+                                               valueBuilder = new 
StringBuilder ();
+                                       valueBuilder.Append 
(nonAtomicStringPool [nodes [iter].Value]);
+                                       break;
                                }
-                               
-                               return valueBuilder.ToString ();
+                               iter++;
                        }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to