summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sax/fastattribs.hxx5
-rw-r--r--sax/source/fastparser/fastparser.cxx1
2 files changed, 6 insertions, 0 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index f8005a65a27a..a45dcba001e3 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -78,6 +78,11 @@ public:
virtual ~FastAttributeList() override;
void clear();
+ void reserve( sal_Int32 nNumTokens )
+ {
+ maAttributeValues.reserve(nNumTokens+1);
+ maAttributeTokens.reserve(nNumTokens);
+ }
void add( sal_Int32 nToken, const sal_Char* pValue );
void add( sal_Int32 nToken, const sal_Char* pValue, size_t nValueLength );
void add( sal_Int32 nToken, const OString& rValue );
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index c910ad83381f..2cb5d1ee6eb6 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -1183,6 +1183,7 @@ void FastSaxParserImpl::callbackStartElement(const xmlChar *localName , const xm
if ( rEntity.mxTokenHandler.is() )
{
// #158414# second: fill attribute list with other attributes
+ rEvent.mxAttributes->reserve( numAttributes );
for (int i = 0; i < numAttributes * 5; i += 5)
{
// attributes[] is ( localname / prefix / nsURI / valueBegin / valueEnd )