Author: amassari
Date: Thu Apr 17 06:40:51 2008
New Revision: 649096
URL: http://svn.apache.org/viewvc?rev=649096&view=rev
Log:
Performance improvements
Modified:
xerces/c/trunk/src/xercesc/internal/ElemStack.cpp
xerces/c/trunk/src/xercesc/util/QName.cpp
xerces/c/trunk/src/xercesc/util/ValueStackOf.c
xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp
Modified: xerces/c/trunk/src/xercesc/internal/ElemStack.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/ElemStack.cpp?rev=649096&r1=649095&r2=649096&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/ElemStack.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/ElemStack.cpp Thu Apr 17 06:40:51 2008
@@ -302,7 +302,7 @@
// Map the prefix to its unique id, from the prefix string pool. If its
// not a valid prefix, then its a failure.
//
- unsigned int prefixId = fPrefixPool.getId(prefixToMap);
+ unsigned int prefixId = (!prefixToMap || !*prefixToMap)?fGlobalPoolId :
fPrefixPool.getId(prefixToMap);
if (!prefixId)
{
unknown = true;
Modified: xerces/c/trunk/src/xercesc/util/QName.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/QName.cpp?rev=649096&r1=649095&r2=649096&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/QName.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/QName.cpp Thu Apr 17 06:40:51 2008
@@ -323,7 +323,19 @@
void QName::setPrefix(const XMLCh* prefix)
{
- setNPrefix(prefix, XMLString::stringLen(prefix));
+ if (!fPrefixBufSz || !XMLString::copyNString(fPrefix, prefix,
fPrefixBufSz))
+ {
+ XMLSize_t newLen = XMLString::stringLen(prefix);
+ fMemoryManager->deallocate(fPrefix); //delete [] fPrefix;
+ fPrefix = 0;
+ fPrefixBufSz = newLen + 8;
+ fPrefix = (XMLCh*) fMemoryManager->allocate
+ (
+ (fPrefixBufSz + 1) * sizeof(XMLCh)
+ ); //new XMLCh[fPrefixBufSz + 1];
+ XMLString::moveChars(fPrefix, prefix, newLen);
+ fPrefix[newLen] = chNull;
+ }
}
void QName::setNPrefix(const XMLCh* prefix, const XMLSize_t newLen)
@@ -344,7 +356,19 @@
void QName::setLocalPart(const XMLCh* localPart)
{
- setNLocalPart(localPart, XMLString::stringLen(localPart));
+ if (!fLocalPartBufSz || !XMLString::copyNString(fLocalPart, localPart,
fLocalPartBufSz))
+ {
+ XMLSize_t newLen = XMLString::stringLen(localPart);
+ fMemoryManager->deallocate(fLocalPart); //delete [] fLocalPart;
+ fLocalPart = 0;
+ fLocalPartBufSz = newLen + 8;
+ fLocalPart = (XMLCh*) fMemoryManager->allocate
+ (
+ (fLocalPartBufSz + 1) * sizeof(XMLCh)
+ ); //new XMLCh[fLocalPartBufSz + 1];
+ XMLString::moveChars(fLocalPart, localPart, newLen);
+ fLocalPart[newLen] = chNull;
+ }
}
void QName::setNLocalPart(const XMLCh* localPart, const XMLSize_t newLen)
Modified: xerces/c/trunk/src/xercesc/util/ValueStackOf.c
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/ValueStackOf.c?rev=649096&r1=649095&r2=649096&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/ValueStackOf.c (original)
+++ xerces/c/trunk/src/xercesc/util/ValueStackOf.c Thu Apr 17 06:40:51 2008
@@ -57,7 +57,7 @@
template <class TElem> const TElem& ValueStackOf<TElem>::peek() const
{
- const int curSize = fVector.size();
+ const unsigned int curSize = fVector.size();
if (curSize == 0)
ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::Stack_EmptyStack,
fVector.getMemoryManager());
@@ -66,7 +66,7 @@
template <class TElem> TElem ValueStackOf<TElem>::pop()
{
- const int curSize = fVector.size();
+ const unsigned int curSize = fVector.size();
if (curSize == 0)
ThrowXMLwithMemMgr(EmptyStackException, XMLExcepts::Stack_EmptyStack,
fVector.getMemoryManager());
Modified: xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp?rev=649096&r1=649095&r2=649096&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUTF8Transcoder.cpp Thu Apr 17 06:40:51
2008
@@ -147,12 +147,9 @@
{
// Handle ASCII in groups instead of single character at a time.
const XMLByte* srcPtr_save = srcPtr;
- do
- {
+ const XMLSize_t chunkSize =
(srcEnd-srcPtr)<(outEnd-outPtr)?(srcEnd-srcPtr):(outEnd-outPtr);
+ for(XMLSize_t i=0;i<chunkSize && *srcPtr <= 127;++i)
*outPtr++ = XMLCh(*srcPtr++);
- } while ( srcPtr != srcEnd &&
- outPtr != outEnd &&
- *srcPtr <= 127 );
memset(sizePtr,1,srcPtr - srcPtr_save);
sizePtr += srcPtr - srcPtr_save;
if (srcPtr == srcEnd || outPtr == outEnd)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]