[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-cvs
Subject:    svn commit: r577837 - in /xerces/c/trunk: samples/src/PSVIWriter/
From:       cargilld () apache ! org
Date:       2007-09-20 17:54:18
Message-ID: 20070920175419.E52951A9832 () eris ! apache ! org
[Download RAW message or body]

Author: cargilld
Date: Thu Sep 20 10:54:18 2007
New Revision: 577837

URL: http://svn.apache.org/viewvc?rev=577837&view=rev
Log:
Minor perf change to avoid calling XMLString::stringLen when only checking for empty \
strings

Modified:
    xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp
    xerces/c/trunk/samples/src/SCMPrint/SCMPrint.cpp
    xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp
    xerces/c/trunk/src/xercesc/util/XMLString.cpp
    xerces/c/trunk/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp
    xerces/c/trunk/tests/src/EncodingTest/EncodingTest.cpp

Modified: xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp?rev=577837&r1=577836&r2=577837&view=diff
 ==============================================================================
--- xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp (original)
+++ xerces/c/trunk/samples/src/PSVIWriter/PSVIWriterHandlers.cpp Thu Sep 20 10:54:18 \
2007 @@ -1371,22 +1371,22 @@
 		XMLString::catString(fTempResult, PSVIUni::fgExtension);
 	}
 	if ((val & XSConstants::DERIVATION_RESTRICTION) != 0) {
-		if (XMLString::stringLen(fTempResult) != 0)
+		if (fTempResult && *fTempResult)
 			XMLString::catString(fTempResult, fgSpace);
 		XMLString::catString(fTempResult, PSVIUni::fgRestriction);
 	}
 	if ((val & XSConstants::DERIVATION_LIST) != 0) {
-		if (XMLString::stringLen(fTempResult) != 0)
+		if (fTempResult && *fTempResult)
 			XMLString::catString(fTempResult, fgSpace);
 		XMLString::catString(fTempResult, PSVIUni::fgList);
 	}
 	if ((val & XSConstants::DERIVATION_UNION) != 0) {
-		if (XMLString::stringLen(fTempResult) != 0)
+		if (fTempResult && *fTempResult)
 			XMLString::catString(fTempResult, fgSpace);
 		XMLString::catString(fTempResult, PSVIUni::fgUnion);
 	}
 	if ((val & XSConstants::DERIVATION_SUBSTITUTION) != 0) {
-		if (XMLString::stringLen(fTempResult) != 0)
+		if (fTempResult && *fTempResult)
 			XMLString::catString(fTempResult, fgSpace);
 		XMLString::catString(fTempResult, PSVIUni::fgSubstitution);
 	}
@@ -1589,7 +1589,7 @@
 	} else {
 		const XMLCh period[] = { chPeriod, chNull };
 		XMLCh anonNum[6];
-		bool hasPrefix = objPrefix!=NULL && XMLString::stringLen(objPrefix)!=0;
+		bool hasPrefix = objPrefix!=NULL && *objPrefix!=0;
 		if (hasPrefix) {
 			XMLString::copyString(result, objPrefix);
 			XMLString::catString(result, period);

Modified: xerces/c/trunk/samples/src/SCMPrint/SCMPrint.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/samples/src/SCMPrint/SCMPrint.cpp?rev=577837&r1=577836&r2=577837&view=diff
 ==============================================================================
--- xerces/c/trunk/samples/src/SCMPrint/SCMPrint.cpp (original)
+++ xerces/c/trunk/samples/src/SCMPrint/SCMPrint.cpp Thu Sep 20 10:54:18 2007
@@ -343,7 +343,7 @@
     
                     XERCES_STD_QUALIFIER cout << "Processing Namespace:   ";
                     const XMLCh *nameSpace = namespaces->elementAt(i);
-                    if (nameSpace && (XMLString::stringLen(nameSpace)>0))
+                    if (nameSpace && *nameSpace)
                         XERCES_STD_QUALIFIER cout << StrX(nameSpace);
                     XERCES_STD_QUALIFIER cout << \
"\n============================================" << XERCES_STD_QUALIFIER endl << \
XERCES_STD_QUALIFIER endl;  
@@ -394,7 +394,7 @@
 {
     XERCES_STD_QUALIFIER cout << "Name:\t\t\t";
     const XMLCh *nameSpace = xsObject->getNamespace();
-    if (nameSpace && (XMLString::stringLen(nameSpace)>0)) {
+    if (nameSpace && *nameSpace) {
         XERCES_STD_QUALIFIER cout << StrX(nameSpace) << ", ";
     }
     XERCES_STD_QUALIFIER cout << StrX(xsObject->getName()) << "\n";

Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp?rev=577837&r1=577836&r2=577837&view=diff
 ==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMNormalizer.cpp Thu Sep 20 10:54:18 2007
@@ -233,10 +233,12 @@
             ((DOMText*)node)->appendData(next->getNodeValue());
             node->getParentNode()->removeChild(next);
             return node;
-        } else if (XMLString::stringLen(node->getNodeValue()) == 0) {
-            node->getParentNode()->removeChild(node);
+        } else {
+            const XMLCh* nv = node->getNodeValue();
+            if (nv == 0 || *nv == 0) {                                   
+                node->getParentNode()->removeChild(node);
+            }
         }
-
     }
     }
 

Modified: xerces/c/trunk/src/xercesc/util/XMLString.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLString.cpp?rev=577837&r1=577836&r2=577837&view=diff
 ==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLString.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLString.cpp Thu Sep 20 10:54:18 2007
@@ -658,7 +658,7 @@
 bool XMLString::isValidEncName(const XMLCh* const name)
 {
 
-    if ( XMLString::stringLen(name) == 0 )
+    if (name == 0 || *name == 0)
         return false;
 
     const XMLCh* tempName = name;

Modified: xerces/c/trunk/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp?rev=577837&r1=577836&r2=577837&view=diff
 ==============================================================================
--- xerces/c/trunk/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp \
                (original)
+++ xerces/c/trunk/src/xercesc/validators/datatype/AnyURIDatatypeValidator.cpp Thu \
Sep 20 10:54:18 2007 @@ -75,7 +75,7 @@
         // According to Java 1.1: URLs may also be specified with a
         // String and the URL object that it is related to.
         //
-        if (XMLString::stringLen(content))
+        if (content && *content)
         {          
               if (!XMLUri::isValidURI(true, content, true))
                 ThrowXMLwithMemMgr1(InvalidDatatypeValueException

Modified: xerces/c/trunk/tests/src/EncodingTest/EncodingTest.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/EncodingTest/EncodingTest.cpp?rev=577837&r1=577836&r2=577837&view=diff
 ==============================================================================
--- xerces/c/trunk/tests/src/EncodingTest/EncodingTest.cpp (original)
+++ xerces/c/trunk/tests/src/EncodingTest/EncodingTest.cpp Thu Sep 20 10:54:18 2007
@@ -180,7 +180,8 @@
 //------------------------------------------------------------------------
 static void eatWhiteSpace(XMLCh* s, unsigned int &i)
 {
-    while (i < XMLString::stringLen(s))
+    size_t len = XMLString::stringLen(s);
+    while (i < len)
     {
     XMLCh c = s[i];
     if (!(c == 0x20 ||           // These are the official XML space characters,
@@ -210,7 +211,8 @@
                                    //                the letters a-f are Unicode \
                0x61-66
                                    // We can't use character literals - we might be
                                    //  building on an EBCDIC machine.
-    while (i < XMLString::stringLen(s))
+    size_t len = XMLString::stringLen(s);
+    while (i < len)
     {
         XMLCh c = s[i];
         if (c >= 0x61 && c <= 0x66)     // Uppercase a-f to A-F.



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic