summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-07-31 11:07:14 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-07-31 12:15:38 +0200
commit550ef55881f992b53f860b7f29f4716846779ea0 (patch)
treecae4d513af26afcd23ea168764c4517cb53a79a6 /editeng/source
parent31c5e451f57ad6172188fddfde5b66ead6f97627 (diff)
Reintroduce OUString::replaceAt taking an OUString to LIBO_INTERNAL_ONLY
This allows optimizations when 'this' is empty, avoiding allocations, and making it possible to not special-case it in other places, as was done in ContentNode::Insert in commit 8ab44b114c6706ab2e3d8a19884daeb544d3c2e1 (tdf#161846 avoid allocation in ContentNode::Insert, 2024-07-30). A couple of disambiguation templated overloads was introduced. Change-Id: I2b5e94c2175379b2696c34e600393d32731f0ab6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171271 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/ContentNode.cxx5
1 files changed, 1 insertions, 4 deletions
diff --git a/editeng/source/editeng/ContentNode.cxx b/editeng/source/editeng/ContentNode.cxx
index de5e2150b151..b7e7f4b0e8ee 100644
--- a/editeng/source/editeng/ContentNode.cxx
+++ b/editeng/source/editeng/ContentNode.cxx
@@ -564,10 +564,7 @@ void ContentNode::SetChar(sal_Int32 nPos, sal_Unicode c)
void ContentNode::Insert(const OUString& rStr, sal_Int32 nPos)
{
- if (nPos == 0 && maString.getLength() == 0)
- maString = rStr; // avoid allocation
- else
- maString = maString.replaceAt(nPos, 0, rStr);
+ maString = maString.replaceAt(nPos, 0, rStr);
}
void ContentNode::Append(std::u16string_view rStr)