reduce memory use on Attribute() caused by Attributes().
authorAtsushi Eno <atsushieno@veritas-vos-liberabit.com>
Mon, 7 Oct 2013 16:25:51 +0000 (01:25 +0900)
committerAtsushi Eno <atsushieno@veritas-vos-liberabit.com>
Mon, 7 Oct 2013 16:25:51 +0000 (01:25 +0900)
mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
mcs/class/System.Xml.Linq/System.Xml.Linq/XName.cs

index 70b6430929a98ab53cd5b4a7f8b7a80854de58d7..81dea5e4a4360cdeb9f14ae5eaea19eb6fc71523 100644 (file)
@@ -382,7 +382,8 @@ namespace System.Xml.Linq
 
                public XAttribute Attribute (XName name)
                {
-                       foreach (XAttribute a in Attributes ())
+                       XAttribute next;
+                       for (XAttribute a = attr_first; a != null; a = a.NextAttribute)
                                if (a.Name == name)
                                        return a;
                        return null;
index 80d0e7b09cb0ac9fc5a9b9d086263001b5753b87..59bbceb4f92a148133bb40ee6f7f9b59e7394e5d 100644 (file)
@@ -153,7 +153,7 @@ namespace System.Xml.Linq
 
                public override string ToString ()
                {
-                       if (ns == XNamespace.None)
+                       if (Object.ReferenceEquals (ns, XNamespace.None))
                                return local;
                        return String.Concat ("{", ns.NamespaceName, "}", local);
                }