cargilld 2004/09/10 11:42:06 Modified: c/src/xercesc/validators/schema SchemaAttDefList.cpp SchemaAttDefList.hpp Log: Performance improvement fix to more efficiently findattdef. Fix from Dave Bertoni. Revision Changes Path 1.12 +17 -4 xml-xerces/c/src/xercesc/validators/schema/SchemaAttDefList.cpp Index: SchemaAttDefList.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaAttDefList.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- SchemaAttDefList.cpp 8 Sep 2004 13:56:56 -0000 1.11 +++ SchemaAttDefList.cpp 10 Sep 2004 18:42:06 -0000 1.12 @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.12 2004/09/10 18:42:06 cargilld + * Performance improvement fix to more efficiently findattdef. Fix from Dave Bertoni. + * * Revision 1.11 2004/09/08 13:56:56 peiyongz * Apache License Version 2.0 * @@ -109,8 +112,13 @@ XMLAttDef* SchemaAttDefList::findAttDef(const unsigned long uriID , const XMLCh* const attName) { - QName tempAtt(attName, uriID, XMLPlatformUtils::fgMemoryManager); - return fList->get((void*)tempAtt.getLocalPart(), uriID); + const int colonInd = XMLString::indexOf(attName, chColon); + + // An index of 0 is really an error, but the QName class doesn't check for + // that case either... + const XMLCh* const localPart = colonInd >= 0 ? attName + colonInd + 1 : attName; + + return fList->get((void*)localPart, uriID); } @@ -118,8 +126,13 @@ SchemaAttDefList::findAttDef( const unsigned long uriID , const XMLCh* const attName) const { - QName tempAtt(attName, uriID, XMLPlatformUtils::fgMemoryManager); - return fList->get((void*)tempAtt.getLocalPart(), uriID); + const int colonInd = XMLString::indexOf(attName, chColon); + + // An index of 0 is really an error, but the QName class doesn't check for + // that case either... + const XMLCh* const localPart = colonInd >= 0 ? attName + colonInd + 1 : attName; + + return fList->get((void*)localPart, uriID); } 1.9 +28 -0 xml-xerces/c/src/xercesc/validators/schema/SchemaAttDefList.hpp Index: SchemaAttDefList.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaAttDefList.hpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- SchemaAttDefList.hpp 8 Sep 2004 13:56:56 -0000 1.8 +++ SchemaAttDefList.hpp 10 Sep 2004 18:42:06 -0000 1.9 @@ -16,6 +16,9 @@ /* * $Log$ + * Revision 1.9 2004/09/10 18:42:06 cargilld + * Performance improvement fix to more efficiently findattdef. Fix from Dave Bertoni. + * * Revision 1.8 2004/09/08 13:56:56 peiyongz * Apache License Version 2.0 * @@ -93,6 +96,7 @@ * @deprecated This method is not thread-safe. */ virtual bool hasMoreElements() const; + virtual bool isEmpty() const; virtual XMLAttDef* findAttDef ( @@ -115,6 +119,18 @@ , const XMLCh* const attName ) const; + virtual XMLAttDef* findAttDefLocalPart + ( + const unsigned long uriID + , const XMLCh* const attLocalPart + ); + + virtual const XMLAttDef* findAttDefLocalPart + ( + const unsigned long uriID + , const XMLCh* const attLocalPart + ) const; + /** * @deprecated This method is not thread-safe. */ @@ -194,6 +210,18 @@ fArray = newArray; } fArray[fCount++] = toAdd; +} + +inline XMLAttDef* SchemaAttDefList::findAttDefLocalPart(const unsigned long uriID + , const XMLCh* const attLocalPart) +{ + return fList->get((void*)attLocalPart, uriID); +} + +inline const XMLAttDef* SchemaAttDefList::findAttDefLocalPart(const unsigned long uriID + , const XMLCh* const attLocalPart) const +{ + return fList->get((void*)attLocalPart, uriID); } XERCES_CPP_NAMESPACE_END
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]