include/rtl/strbuf.hxx  |    9 +++------
 include/rtl/ustrbuf.hxx |   17 +++++------------
 2 files changed, 8 insertions(+), 18 deletions(-)

New commits:
commit f5d02bdc6831588c0442fa24c5913971a224c4fa
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Oct 10 11:09:24 2019 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 11 15:05:41 2019 +0200

    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.kagan...@collabora.com>

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 */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to