svl/source/misc/sharedstring.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
New commits: commit 093143c5754ea1f8ec5e886468e124547ec5e21a Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Sep 27 11:12:29 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Tue Sep 27 11:21:37 2022 +0200 Reduce number of static objects a bit Change-Id: I80f0e8edeb4aa0b6a2179745ae9eda37cac278d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140641 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/svl/source/misc/sharedstring.cxx b/svl/source/misc/sharedstring.cxx index 71f3354eca51..499136da972f 100644 --- a/svl/source/misc/sharedstring.cxx +++ b/svl/source/misc/sharedstring.cxx @@ -11,15 +11,15 @@ namespace svl { -/** ref-counting traffic associated with SharedString temporaries can be significant, so use a singleton here, so we can return a const& from getEmptyString */ -static OUString EMPTY(u""); -const SharedString EMPTY_SHARED_STRING(EMPTY.pData, EMPTY.pData); -const OUString SharedString::EMPTY_STRING {}; +const OUString SharedString::EMPTY_STRING; const SharedString & SharedString::getEmptyString() { + // ref-counting traffic associated with SharedString temporaries can be significant, + // so use a singleton here, so we can return a const& from getEmptyString. // unicode string array for empty string is globally shared in OUString. // Let's take advantage of that. + static const SharedString EMPTY_SHARED_STRING(EMPTY_STRING.pData, EMPTY_STRING.pData); return EMPTY_SHARED_STRING; }