diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-25 10:41:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-03-25 12:24:24 +0100 |
commit | 77224aaec6ba89194a404805d7190f88e92fcc9f (patch) | |
tree | 2b5177988bee52d2a094f8383dd512e931585651 | |
parent | ab29c857c669bcca3d8eea8a5a9e6ad5eae622d7 (diff) |
tdf#158556 speedup docx load
move the vector outside the loop, avoid repeated allocations
Change-Id: Ic6ef95a966ffd5c4115ea56e63af1494e7937928
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165270
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/core/docnode/nodes.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 5f059f94c519..76f9362a1442 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -2320,6 +2320,7 @@ void SwNodes::RemoveNode( SwNodeOffset nDelPos, SwNodeOffset nSz, bool bDel ) #ifndef NDEBUG SwNode *const pFirst((*this)[nDelPos]); #endif + std::vector<SwTextAttr*> flys; for (SwNodeOffset nCnt(0); nCnt < nSz; nCnt++) { SwNode* pNode = (*this)[ nDelPos + nCnt ]; @@ -2332,11 +2333,11 @@ void SwNodes::RemoveNode( SwNodeOffset nDelPos, SwNodeOffset nSz, bool bDel ) // so their anchor still points to correct node when deleted! // NOTE: this will call RemoveNode() recursively! // so adjust our indexes to account for removed nodes - SwNodeOffset const nPos = pTextNd->GetIndex(); SwpHints *const pHints(pTextNd->GetpSwpHints()); if (pHints) { - std::vector<SwTextAttr*> flys; + SwNodeOffset const nPos = pTextNd->GetIndex(); + flys.clear(); for (size_t i = 0; i < pHints->Count(); ++i) { SwTextAttr *const pHint(pHints->Get(i)); |