Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorBen Maurer <benm@mono-cvs.ximian.com>2003-09-13 22:38:53 +0400
committerBen Maurer <benm@mono-cvs.ximian.com>2003-09-13 22:38:53 +0400
commitb0d1119294918362f98face10bf37788dd8fe397 (patch)
treedcf503c583ad6f5e0dd47f4c65294f59585383f5 /mcs
parent42f2e5051bff00cb0ccce27051a5b28d775ab03e (diff)
reduce enumerator allocation
svn path=/trunk/mcs/; revision=18064
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog4
-rw-r--r--mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs18
2 files changed, 16 insertions, 6 deletions
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
index 147edf3ec3a..ef48dd62ee5 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/ChangeLog
@@ -1,3 +1,7 @@
+2003-09-13 Ben Maurer <bmaurer@users.sourceforge.net>
+
+ * XslLiteralElement.cs: reduce enumerator allocation.
+
2003-08-30 Oleg Tkachenko <oleg@tkachenko.com>
* XslAttribute.cs: output is now done to TextOutputter, which outputs
diff --git a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
index d515a24c098..4b87ffcbee3 100644
--- a/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
+++ b/mcs/class/System.XML/Mono.Xml.Xsl.Operations/XslLiteralElement.cs
@@ -19,7 +19,7 @@ namespace Mono.Xml.Xsl.Operations {
public class XslLiteralElement : XslCompiledElement {
XslOperation children;
string localname, prefix, nsUri;
- ArrayList attrs = new ArrayList ();
+ ArrayList attrs;
XmlQualifiedName [] useAttributeSets;
Hashtable nsDecls;
@@ -51,9 +51,11 @@ namespace Mono.Xml.Xsl.Operations {
this.localname = c.Input.LocalName;
this.useAttributeSets = c.ParseQNameListAttribute ("use-attribute-sets", XsltNamespace);
this.nsDecls = c.GetNamespacesToCopy ();
+ if (nsDecls.Count == 0) nsDecls = null;
if (c.Input.MoveToFirstAttribute ())
{
+ attrs = new ArrayList ();
do {
if (c.Input.NamespaceURI == XsltNamespace)
continue; //already handled
@@ -71,11 +73,15 @@ namespace Mono.Xml.Xsl.Operations {
{
p.Out.WriteStartElement (prefix, localname, nsUri);
- foreach (DictionaryEntry de in nsDecls)
- p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value);
-
- foreach (XslLiteralAttribute a in attrs)
- a.Evaluate (p);
+ if (nsDecls != null)
+ foreach (DictionaryEntry de in nsDecls)
+ p.Out.WriteNamespaceDecl ((string)de.Key, (string)de.Value);
+
+ if (attrs != null) {
+ int len = attrs.Count;
+ for (int i = 0; i < len; i++)
+ ((XslLiteralAttribute)attrs [i]).Evaluate (p);
+ }
if (useAttributeSets != null)
foreach (XmlQualifiedName s in useAttributeSets)