diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-09-13 15:13:55 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-09-24 12:58:14 +0200 |
commit | 2f5f45921b05904a4be1ff633be09c62cb44ff08 (patch) | |
tree | ddd0cd5ef0349706f935d8360db88343347639a3 /configmgr | |
parent | a7d40f575463467698df76f041e558cb3bea7c85 (diff) |
support O(U)String::number() for fast string concatenation
When I did the fast string concatenation, I didn't add any support
for number(), which simply returned a O(U)String, and so it did
the extra allocation/deallocation, although that could be avoided.
In order to support this, number() now returns a special temporary
return type, similarly to O(U)StringConcat, which allows delaying
the concatenation the same way.
Also similarly, the change of the return type in some cases requires
explicit cast to the actual string type. Usage of OString::getStr()
is so extensive in the codebase that I actually added it to the helper
class, after that it's only relatively few cases.
Change-Id: Iba6e158010e1e458089698c426803052b6f46031
Reviewed-on: https://gerrit.libreoffice.org/78873
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/writemodfile.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index 017e925dee48..d7fba8264b80 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -155,19 +155,19 @@ void writeValueContent_(TempFile &handle, sal_Bool value) { } void writeValueContent_(TempFile &handle, sal_Int16 value) { - handle.writeString(OString::number(value)); + handle.writeString(OString(OString::number(value))); } void writeValueContent_(TempFile &handle, sal_Int32 value) { - handle.writeString(OString::number(value)); + handle.writeString(OString(OString::number(value))); } void writeValueContent_(TempFile &handle, sal_Int64 value) { - handle.writeString(OString::number(value)); + handle.writeString(OString(OString::number(value))); } void writeValueContent_(TempFile &handle, double value) { - handle.writeString(OString::number(value)); + handle.writeString(OString(OString::number(value))); } void writeValueContent_(TempFile &handle, const OUString& value) { @@ -530,7 +530,7 @@ void writeValueContent(TempFile &handle, std::u16string_view value) { { handle.writeString(convertToUtf8(value.substr(i, j - i))); handle.writeString("<unicode oor:scalar=\""); - handle.writeString(OString::number(c)); + handle.writeString(OString(OString::number(c))); handle.writeString("\"/>"); i = j + 1; } else if (c == '\x0D') { |