diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-02-27 09:42:35 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-02-27 10:25:43 +0100 |
commit | bedb7118f5ca2cd19f4bc1eac1b26498ee5ef113 (patch) | |
tree | 1518cf0b35ec7798a6db8c3d3aae3b9ed9211f7e /sal | |
parent | 77ebac1021e1e795b6c6a7456a2ed8c56dd9370c (diff) |
Simplify newTrim
Change-Id: I36e2f8b0f0f4829fba32e637fe61cebe9e67cf91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130630
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/strtmpl.hxx | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx index c5cdc23fbc84..9cbc8148044a 100644 --- a/sal/rtl/strtmpl.hxx +++ b/sal/rtl/strtmpl.hxx @@ -1576,28 +1576,13 @@ template <typename IMPL_RTL_STRINGDATA> void newTrim ( IMPL_RTL_STRINGDATA** ppThis, IMPL_RTL_STRINGDATA* pStr ) { - assert(ppThis); assert(pStr); - IMPL_RTL_STRINGDATA* pOrg = *ppThis; const auto view = trimView(pStr->buffer, pStr->length); if (static_cast<sal_Int32>(view.size()) == pStr->length) - { - *ppThis = pStr; - acquire( pStr ); - } + assign(ppThis, pStr); else - { - sal_Int32 nLen = static_cast<sal_Int32>(view.size()); - *ppThis = Alloc<IMPL_RTL_STRINGDATA>( nLen ); - assert(*ppThis); - Copy( (*ppThis)->buffer, view.data(), nLen ); - } - - RTL_LOG_STRING_NEW( *ppThis ); - /* must be done last, if pStr == *ppThis */ - if ( pOrg ) - release( pOrg ); + newFromStr_WithLength(ppThis, view.data(), view.size()); } /* ----------------------------------------------------------------------- */ |