You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2007/03/27 21:16:22 UTC

svn commit: r523038 - in /xerces/c/trunk/src/xercesc: internal/XMLReader.cpp internal/XMLReader.hpp internal/XMLScanner.cpp util/XMLString.hpp

Author: amassari
Date: Tue Mar 27 12:16:21 2007
New Revision: 523038

URL: http://svn.apache.org/viewvc?view=rev&rev=523038
Log:
Performance improvements

Modified:
    xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
    xerces/c/trunk/src/xercesc/internal/XMLReader.hpp
    xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
    xerces/c/trunk/src/xercesc/util/XMLString.hpp

Modified: xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLReader.cpp?view=diff&rev=523038&r1=523037&r2=523038
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.cpp Tue Mar 27 12:16:21 2007
@@ -1130,7 +1130,7 @@
         //  dirty comparison straight to its buffer with no requirement to unget
         //  if it fails.
         //
-        if (XMLString::compareNString(&fCharBuf[fCharIndex], toSkip, srcLen))
+        if (memcmp(&fCharBuf[fCharIndex], toSkip, srcLen*sizeof(XMLCh)))
             return false;
 
         //
@@ -1146,7 +1146,7 @@
             if (charsLeft == 0)
                 return false; // error situation
         }
-        if (XMLString::compareNString(&fCharBuf[fCharIndex], toSkip, charsLeft))
+        if (memcmp(&fCharBuf[fCharIndex], toSkip, charsLeft*sizeof(XMLCh)))
             return false;
 
         fCharIndex += charsLeft;
@@ -1161,7 +1161,7 @@
                 return false; // error situation
             if (charsLeft > remainingLen)
                 charsLeft = remainingLen;
-            if (XMLString::compareNString(&fCharBuf[fCharIndex], toSkip+offset, charsLeft))
+            if (memcmp(&fCharBuf[fCharIndex], toSkip+offset, charsLeft*sizeof(XMLCh)))
                 return false;
             offset += charsLeft;
             remainingLen -= charsLeft;
@@ -1215,7 +1215,7 @@
     //  dirty comparison straight to its buffer with no requirement to unget
     //  if it fails.
     //
-    if (XMLString::compareNString(&fCharBuf[fCharIndex], toPeek, srcLen))
+    if (memcmp(&fCharBuf[fCharIndex], toPeek, srcLen*sizeof(XMLCh)))
         return false;
 
     return true;
@@ -1857,8 +1857,6 @@
     {
         fCurCol++;
     }
-
-    return;
 }
 
 XERCES_CPP_NAMESPACE_END

Modified: xerces/c/trunk/src/xercesc/internal/XMLReader.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLReader.hpp?view=diff&rev=523038&r1=523037&r2=523038
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.hpp Tue Mar 27 12:16:21 2007
@@ -771,7 +771,7 @@
     //  normal char get method in regards to newline normalization, though
     //  its not as complicated as the actual character getting method's.
     //
-    if ((chGotten == chCR || ((chGotten == chNEL || chGotten == chLineSeparator) && fNEL))
+    if ((chGotten == chCR || (fNEL && (chGotten == chNEL || chGotten == chLineSeparator)))
         && (fSource == Source_External))
         chGotten = chLF;
 

Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp?view=diff&rev=523038&r1=523037&r2=523038
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp Tue Mar 27 12:16:21 2007
@@ -1946,6 +1946,11 @@
     //  in order to catch the scenario where the current entity ended at
     //  the > of some markup.
     XMLCh nextCh;
+
+    // avoid setting up the ThrowEOEJanitor if we know that we have data in the current reader
+    if(fReaderMgr.getCurrentReader() && fReaderMgr.getCurrentReader()->charsLeftInBuffer()>0)
+        nextCh = fReaderMgr.peekNextChar();
+    else
     {
         ThrowEOEJanitor janMgr(&fReaderMgr, true);
         nextCh = fReaderMgr.peekNextChar();

Modified: xerces/c/trunk/src/xercesc/util/XMLString.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLString.hpp?view=diff&rev=523038&r1=523037&r2=523038
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLString.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLString.hpp Tue Mar 27 12:16:21 2007
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id $
+ * $Id$
  */
 
 #if !defined(XMLSTRING_HPP)
@@ -1521,14 +1521,10 @@
         return 0;
 
     const XMLCh* curCh = tohash;
-    unsigned int hashVal = (unsigned int)(*curCh);
-    curCh++;
+    unsigned int hashVal = (unsigned int)(*curCh++);
 
     while (*curCh)
-    {
-        hashVal = (hashVal * 38) + (hashVal >> 24) + (unsigned int)(*curCh);
-        curCh++;
-    }
+        hashVal = (hashVal * 38) + (hashVal >> 24) + (unsigned int)(*curCh++);
 
     // Divide by modulus
     return hashVal % hashModulus;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org