diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-10 11:09:24 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-11 15:05:41 +0200 |
commit | f5d02bdc6831588c0442fa24c5913971a224c4fa (patch) | |
tree | 759600927f16f2056034a598dfe61936c9dd3bc0 /include/rtl | |
parent | 312e752ca5f32d774ecbe8f7d997805e8608ad73 (diff) |
Forward constarray-handling append/insert code to basic methods
so that we only have small number of places where to track capacity change
(I need that to try to analyze where the reallocations happen most often)
Change-Id: I077d5ebab845cb7e1deaac363d46e1fb2dbbb0c7
Reviewed-on: https://gerrit.libreoffice.org/80593
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/rtl')
-rw-r--r-- | include/rtl/strbuf.hxx | 9 | ||||
-rw-r--r-- | include/rtl/ustrbuf.hxx | 17 |
2 files changed, 8 insertions, 18 deletions
diff --git a/include/rtl/strbuf.hxx b/include/rtl/strbuf.hxx index 832c48959d47..afead770298d 100644 --- a/include/rtl/strbuf.hxx +++ b/include/rtl/strbuf.hxx @@ -531,11 +531,9 @@ public: RTL_STRING_CONST_FUNCTION assert( libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal)); - rtl_stringbuffer_insert( - &pData, &nCapacity, getLength(), + return append( libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); - return *this; } /** @@ -801,11 +799,10 @@ public: RTL_STRING_CONST_FUNCTION assert( libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal)); - rtl_stringbuffer_insert( - &pData, &nCapacity, offset, + return insert( + offset, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); - return *this; } /** diff --git a/include/rtl/ustrbuf.hxx b/include/rtl/ustrbuf.hxx index 4016eaf210d9..1f12ef9caeb9 100644 --- a/include/rtl/ustrbuf.hxx +++ b/include/rtl/ustrbuf.hxx @@ -631,11 +631,9 @@ public: { assert( libreoffice_internal::ConstCharArrayDetector<T>::isValid(literal)); - rtl_uStringbuffer_insert_ascii( - &pData, &nCapacity, getLength(), + return appendAscii( libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); - return *this; } #if defined LIBO_INTERNAL_ONLY @@ -644,18 +642,14 @@ public: typename libreoffice_internal::ConstCharArrayDetector< T, OUStringBuffer &>::TypeUtf16 append(T & literal) { - rtl_uStringbuffer_insert( - &pData, &nCapacity, getLength(), + return append( libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); - return *this; } /** @overload @since LibreOffice 5.4 */ OUStringBuffer & append(OUStringLiteral const & literal) { - rtl_uStringbuffer_insert_ascii( - &pData, &nCapacity, getLength(), literal.data, literal.size); - return *this; + return appendAscii(literal.data, literal.size); } #endif @@ -1025,11 +1019,10 @@ public: typename libreoffice_internal::ConstCharArrayDetector< T, OUStringBuffer &>::TypeUtf16 insert(sal_Int32 offset, T & literal) { - rtl_uStringbuffer_insert( - &pData, &nCapacity, offset, + return insert( + offset, libreoffice_internal::ConstCharArrayDetector<T>::toPointer(literal), libreoffice_internal::ConstCharArrayDetector<T>::length); - return *this; } /** @overload @since LibreOffice 5.4 */ |