[mono/mono] 5d250224: reduce memory use on Attribute() caused by Attributes().

"Atsushi Eno ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014193bf6742-b7feba21-a95d-4a3d-b8ab-74b56d9b7444-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/43a0a9d47fb5...5d250224236e

   Commit: 5d250224236e6a6cd7022ba9cdb93a5fdb842004
   Author: Atsushi Eno <[email protected]> (atsushieno)
     Date: 2013-10-07 16:25:51 GMT
      URL: https://github.com/mono/mono/commit/5d250224236e6a6cd7022ba9cdb93a5fdb842004

reduce memory use on Attribute() caused by Attributes().

Changed paths:
  M mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
  M mcs/class/System.Xml.Linq/System.Xml.Linq/XName.cs

Modified: mcs/class/System.Xml.Linq/System.Xml.Linq/XElement.cs
===================================================================
@@ -382,7 +382,8 @@ public XElement (XStreamingElement other)
 
 		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;

Modified: mcs/class/System.Xml.Linq/System.Xml.Linq/XName.cs
===================================================================
@@ -153,7 +153,7 @@ public override int GetHashCode ()
 
 		public override string ToString ()
 		{
-			if (ns == XNamespace.None)
+			if (Object.ReferenceEquals (ns, XNamespace.None))
 				return local;
 			return String.Concat ("{", ns.NamespaceName, "}", local);
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.