tng         2002/09/24 13:07:19

  Modified:    c/src/xercesc/dom/impl DOMDeepNodeListImpl.cpp
                        DOMDeepNodeListPool.c DOMDocumentTypeImpl.cpp
                        DOMElementImpl.cpp DOMImplementationImpl.cpp
                        DOMNamedNodeMapImpl.cpp DOMNodeIDMap.cpp
                        DOMStringPool.cpp
  Log:
  Performance: use XMLString::equals instead of XMLString::compareString
  
  Revision  Changes    Path
  1.4       +7 -10     xml-xerces/c/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp
  
  Index: DOMDeepNodeListImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDeepNodeListImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMDeepNodeListImpl.cpp   31 Jul 2002 20:38:52 -0000      1.3
  +++ DOMDeepNodeListImpl.cpp   24 Sep 2002 20:07:18 -0000      1.4
  @@ -79,7 +79,7 @@
       , fMatchURIandTagname(false)
   {
       fTagName = ((DOMDocumentImpl 
*)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(tagName);
  -    fMatchAll = (XMLString::compareString(fTagName, kAstr) == 0);
  +    fMatchAll = XMLString::equals(fTagName, kAstr);
   }
   
   
  @@ -95,8 +95,8 @@
       , fMatchURIandTagname(true)
   {
       fTagName = ((DOMDocumentImpl 
*)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(localName);
  -    fMatchAll = (XMLString::compareString(fTagName, kAstr) == 0);
  -    fMatchAllURI = (XMLString::compareString(namespaceURI, kAstr) == 0);
  +    fMatchAll = XMLString::equals(fTagName, kAstr);
  +    fMatchAllURI = XMLString::equals(namespaceURI, kAstr);
       fNamespaceURI = ((DOMDocumentImpl 
*)(castToNodeImpl(rootNode)->getOwnerDocument()))->getPooledString(namespaceURI);
   }
   
  @@ -231,18 +231,15 @@
   
               if (!fMatchURIandTagname) {        //DOM Level 1
                   if (fMatchAll ||
  -                    (XMLString::compareString(currElement->getTagName(),
  -                                              fTagName) == 0))
  +                    XMLString::equals(currElement->getTagName(), fTagName))
                       return current;
               } else {        //DOM Level 2
                   if (!fMatchAllURI &&
  -                    (XMLString::compareString(current -> getNamespaceURI(),
  -                                              fNamespaceURI) != 0))
  +                    !XMLString::equals(current->getNamespaceURI(), fNamespaceURI))
                       continue;
   
                   if (fMatchAll ||
  -                    (XMLString::compareString(current -> getLocalName(),
  -                                              fTagName) == 0))
  +                    XMLString::equals(current->getLocalName(), fTagName))
                       return current;
               }
           }
  
  
  
  1.3       +3 -3      xml-xerces/c/src/xercesc/dom/impl/DOMDeepNodeListPool.c
  
  Index: DOMDeepNodeListPool.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDeepNodeListPool.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMDeepNodeListPool.c     27 May 2002 18:12:19 -0000      1.2
  +++ DOMDeepNodeListPool.c     24 Sep 2002 20:07:18 -0000      1.3
  @@ -359,7 +359,7 @@
       {
           //key2 and key3 are XMLCh*, compareString takes null pointer vs zero len 
string the same
           //but we need them to be treated as different keys in this case
  -        if (fHash->equals(key1, curElem->fKey1) && (!XMLString::compareString(key2, 
curElem->fKey2)) && (!XMLString::compareString(key3, curElem->fKey3))) {
  +        if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, 
curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
               if (!key2 || !curElem->fKey2) {
                   if (key2 || curElem->fKey2) {
                       curElem = curElem->fNext;
  @@ -395,7 +395,7 @@
       {
           //key2 and key3 are XMLCh*, compareString takes null pointer vs zero len 
string the same
           //but we need them to be treated as different keys in this case
  -        if (fHash->equals(key1, curElem->fKey1) && (!XMLString::compareString(key2, 
curElem->fKey2)) && (!XMLString::compareString(key3, curElem->fKey3))) {
  +        if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, 
curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
               if (!key2 || !curElem->fKey2) {
                   if (key2 || curElem->fKey2) {
                       curElem = curElem->fNext;
  
  
  
  1.17      +4 -4      xml-xerces/c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp
  
  Index: DOMDocumentTypeImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DOMDocumentTypeImpl.cpp   23 Sep 2002 20:06:04 -0000      1.16
  +++ DOMDocumentTypeImpl.cpp   24 Sep 2002 20:07:18 -0000      1.17
  @@ -495,7 +495,7 @@
               return false;
           }
       }
  -    else if (XMLString::compareString(getPublicId(), argDT->getPublicId())) {
  +    else if (!XMLString::equals(getPublicId(), argDT->getPublicId())) {
           return false;
       }
   
  @@ -504,7 +504,7 @@
               return false;
           }
       }
  -    else if (XMLString::compareString(getSystemId(), argDT->getSystemId())) {
  +    else if (!XMLString::equals(getSystemId(), argDT->getSystemId())) {
           return false;
       }
   
  @@ -513,7 +513,7 @@
               return false;
           }
       }
  -    else if (XMLString::compareString(getInternalSubset(), 
argDT->getInternalSubset())) {
  +    else if (!XMLString::equals(getInternalSubset(), argDT->getInternalSubset())) {
           return false;
       }
   
  
  
  
  1.15      +2 -2      xml-xerces/c/src/xercesc/dom/impl/DOMElementImpl.cpp
  
  Index: DOMElementImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMElementImpl.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DOMElementImpl.cpp        23 Sep 2002 19:41:07 -0000      1.14
  +++ DOMElementImpl.cpp        24 Sep 2002 20:07:18 -0000      1.15
  @@ -478,7 +478,7 @@
           DOMNode* attrNode = fAttributes->getNamedItem(xmlBaseString);
           if (attrNode) {
               const XMLCh* uri =  attrNode->getNodeValue();
  -            if (XMLString::stringLen(uri) != 0 ) {// attribute value is always 
empty string
  +            if (uri && *uri) {// attribute value is always empty string
                   try {
                       XMLUri temp(baseURI);
                       XMLUri temp2(&temp, uri);
  
  
  
  1.8       +5 -5      xml-xerces/c/src/xercesc/dom/impl/DOMImplementationImpl.cpp
  
  Index: DOMImplementationImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMImplementationImpl.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMImplementationImpl.cpp 1 Aug 2002 13:49:13 -0000       1.7
  +++ DOMImplementationImpl.cpp 24 Sep 2002 20:07:18 -0000      1.8
  @@ -148,10 +148,10 @@
       if (!feature)
           return false;
   
  -    bool anyVersion = (version == 0 || XMLString::stringLen(version) == 0);
  -    bool version1_0 = (XMLString::compareString(version, g1_0) == 0);
  -    bool version2_0 = (XMLString::compareString(version, g2_0) == 0);
  -    bool version3_0 = (XMLString::compareString(version, g3_0) == 0);
  +    bool anyVersion = (version == 0 || !*version);
  +    bool version1_0 = XMLString::equals(version, g1_0);
  +    bool version2_0 = XMLString::equals(version, g2_0);
  +    bool version3_0 = XMLString::equals(version, g3_0);
   
       // Currently, we support only XML Level 1 version 1.0
       if (XMLString::compareIString(feature, gXML) == 0
  
  
  
  1.8       +4 -4      xml-xerces/c/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp
  
  Index: DOMNamedNodeMapImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMNamedNodeMapImpl.cpp   16 Aug 2002 18:00:31 -0000      1.7
  +++ DOMNamedNodeMapImpl.cpp   24 Sep 2002 20:07:18 -0000      1.8
  @@ -315,12 +315,12 @@
           DOMNode *node = fNodes -> elementAt(i);
           const XMLCh * nNamespaceURI = node->getNamespaceURI();
           const XMLCh * nLocalName = node->getLocalName();
  -        if (XMLString::compareString(nNamespaceURI, namespaceURI))    //URI not 
match
  +        if (!XMLString::equals(nNamespaceURI, namespaceURI))    //URI not match
               continue;
           else {
  -            if (XMLString::compareString(localName, nLocalName) == 0
  +            if (XMLString::equals(localName, nLocalName)
                   ||
  -                (nLocalName == 0 && (XMLString::compareString(localName, 
node->getNodeName()) == 0)))
  +                (nLocalName == 0 && XMLString::equals(localName, 
node->getNodeName())))
                   return i;
           }
       }
  
  
  
  1.3       +2 -2      xml-xerces/c/src/xercesc/dom/impl/DOMNodeIDMap.cpp
  
  Index: DOMNodeIDMap.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMNodeIDMap.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMNodeIDMap.cpp  27 May 2002 18:20:10 -0000      1.2
  +++ DOMNodeIDMap.cpp  24 Sep 2002 20:07:18 -0000      1.3
  @@ -216,7 +216,7 @@
           }
   
   
  -        if ((tableSlot != (DOMAttr *)-1) && 
XMLString::compareString(tableSlot->getValue(), id) == 0)
  +        if ((tableSlot != (DOMAttr *)-1) && 
XMLString::equals(tableSlot->getValue(), id))
               return tableSlot;
   
           currentHash += initalHash;  // rehash
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/dom/impl/DOMStringPool.cpp
  
  Index: DOMStringPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/impl/DOMStringPool.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOMStringPool.cpp 8 Aug 2002 19:07:43 -0000       1.3
  +++ DOMStringPool.cpp 24 Sep 2002 20:07:18 -0000      1.4
  @@ -129,7 +129,7 @@
       pspe = &fHashTable[inHash];
       while (*pspe != 0)
       {
  -        if (XMLString::compareString((*pspe)->fString, in) == 0)
  +        if (XMLString::equals((*pspe)->fString, in))
               return (*pspe)->fString;
           pspe = &((*pspe)->fNext);
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to