diff options
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index f2f90c48bb18..96993f8589c1 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -224,8 +224,8 @@ public: void pushEntity( const Entity& rEntity ); void popEntity(); - Entity& getEntity(); - const Entity& getEntity() const; + Entity& getEntity() { return *mpTop; } + const Entity& getEntity() const { return *mpTop; } void parse(); void produce( CallbackType aType ); @@ -256,6 +256,8 @@ private: NamespaceMap maNamespaceMap; ParserData maData; /// Cached parser configuration for next call of parseStream(). + + Entity *mpTop; /// std::stack::top() is amazingly slow => cache this. ::std::stack< Entity > maEntities; /// Entity stack for each call of parseStream(). FastTokenLookup maTokenLookup; }; @@ -619,7 +621,9 @@ void Entity::saveException( const Exception &e ) namespace sax_fastparser { -FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* pFront ) : mpFront(pFront) +FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* pFront ) : + mpFront(pFront), + mpTop(NULL) { mxDocumentLocator.set( new FastLocatorImpl( this ) ); } @@ -1038,21 +1042,13 @@ bool FastSaxParserImpl::consume(EventList *pEventList) void FastSaxParserImpl::pushEntity( const Entity& rEntity ) { maEntities.push( rEntity ); + mpTop = &maEntities.top(); } void FastSaxParserImpl::popEntity() { maEntities.pop(); -} - -Entity& FastSaxParserImpl::getEntity() -{ - return maEntities.top(); -} - -const Entity& FastSaxParserImpl::getEntity() const -{ - return maEntities.top(); + mpTop = &maEntities.top(); } // starts parsing with actual parser ! |