summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-09-27 11:12:29 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-09-27 11:21:37 +0200
commit093143c5754ea1f8ec5e886468e124547ec5e21a (patch)
tree2c5ca15becece876c08f4566943b31f04ca51ed5 /svl
parent5d48602bfc2083294fc7d6a370bae4ce689be59e (diff)
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.kaganski@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/misc/sharedstring.cxx8
1 files changed, 4 insertions, 4 deletions
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;
}