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 2008/04/17 22:14:28 UTC

svn commit: r649259 - in /xerces/c/trunk/src/xercesc/util: NameIdPool.c StringPool.hpp

Author: amassari
Date: Thu Apr 17 13:14:20 2008
New Revision: 649259

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

Modified:
    xerces/c/trunk/src/xercesc/util/NameIdPool.c
    xerces/c/trunk/src/xercesc/util/StringPool.hpp

Modified: xerces/c/trunk/src/xercesc/util/NameIdPool.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NameIdPool.c?rev=649259&r1=649258&r2=649259&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NameIdPool.c (original)
+++ xerces/c/trunk/src/xercesc/util/NameIdPool.c Thu Apr 17 13:14:20 2008
@@ -84,6 +84,7 @@
 template <class TElem> bool
 NameIdPool<TElem>::containsKey(const XMLCh* const key) const
 {
+    if (fIdCounter == 0) return false;
     return fBucketList->containsKey(key);
 }
 
@@ -105,12 +106,14 @@
 template <class TElem> TElem*
 NameIdPool<TElem>::getByKey(const XMLCh* const key)
 {
+    if (fIdCounter == 0) return 0;
     return fBucketList->get(key);
 }
 
 template <class TElem> const TElem*
 NameIdPool<TElem>::getByKey(const XMLCh* const key) const
 {
+    if (fIdCounter == 0) return 0;
     return fBucketList->get(key);
 }
 
@@ -147,7 +150,7 @@
 unsigned int NameIdPool<TElem>::put(TElem* const elemToAdopt)
 {
     // First see if the key exists already. If so, its an error
-    if(fBucketList->containsKey(elemToAdopt->getKey()))
+    if(containsKey(elemToAdopt->getKey()))
     {
         ThrowXMLwithMemMgr1
         (

Modified: xerces/c/trunk/src/xercesc/util/StringPool.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/StringPool.hpp?rev=649259&r1=649258&r2=649259&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/StringPool.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/StringPool.hpp Thu Apr 17 13:14:20 2008
@@ -153,10 +153,7 @@
 
 inline bool XMLStringPool::exists(const unsigned int id) const
 {
-    if (!id || (id >= fCurId))
-        return false;
-
-    return true;
+    return (id > 0 && (id < fCurId));
 }
 
 inline const XMLCh* XMLStringPool::getValueForId(const unsigned int id) const



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