Ver código fonte

Dont make function call to StringBuffer

svn path=/trunk/mcs/; revision=17981
Ben Maurer 22 anos atrás
pai
commit
68ec5ce1a6
1 arquivos alterados com 6 adições e 3 exclusões
  1. 6 3
      mcs/class/System.XML/System.Xml/XmlParserInput.cs

+ 6 - 3
mcs/class/System.XML/System.Xml/XmlParserInput.cs

@@ -69,11 +69,12 @@ namespace Mono.Xml.Native
 		public void InsertParameterEntityBuffer (string value)
 		{
 			this.peBuffer.Insert (0, ' ' + value + ' ');
+			peStored = true;
 		}
 
 		public int PeekChar ()
 		{
-			if (peBuffer.Length > 0)
+			if (peStored)
 				return peBuffer [0];
 
 			if (can_seek)
@@ -91,9 +92,10 @@ namespace Mono.Xml.Native
 		{
 			int ch;
 
-			if (peBuffer.Length > 0) {
+			if (peStored) {
 				ch = peBuffer [0];
 				peBuffer.Remove (0, 1);
+				peStored = peBuffer.Length > 0;
 				// I decided not to add character to currentTag with respect to PERef value
 				return ch;
 			}
@@ -128,7 +130,7 @@ namespace Mono.Xml.Native
 		private char [] wsChars = new char [] {' ', '\r', '\n', '\t'};
 		public bool HasPEBuffer {
 			get {
-				if (peBuffer.Length == 0)
+				if (!peStored)
 					return false;
 				else if (peBuffer.ToString ().Trim (wsChars).Length == 0)
 					return false;
@@ -194,6 +196,7 @@ namespace Mono.Xml.Native
 		int parsedValueEnd;
 		StringBuilder peBuffer = new StringBuilder ();
 		string baseURI;
+		bool peStored = false;
 
 		private int ParseCharReference (string name)
 		{