sal/rtl/strtmpl.hxx | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
New commits: commit bedb7118f5ca2cd19f4bc1eac1b26498ee5ef113 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Feb 27 09:42:35 2022 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Sun Feb 27 10:25:43 2022 +0100 Simplify newTrim Change-Id: I36e2f8b0f0f4829fba32e637fe61cebe9e67cf91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130630 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> 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()); } /* ----------------------------------------------------------------------- */