diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-07-29 13:08:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-29 19:11:01 +0200 |
commit | 034203742d43045df1a6a733a81fb929ee840aac (patch) | |
tree | a885bd296624cd9fb5000b2fd5b0a0d02cd532c8 /sal | |
parent | ofz#7790 reduce row limit further for fuzzing (diff) | |
download | core-034203742d43045df1a6a733a81fb929ee840aac.tar.gz core-034203742d43045df1a6a733a81fb929ee840aac.zip |
optimise newFromStr functions
use the other functions in this module so we get the compiler builtins
if available
Change-Id: Idbd9df44e057e573dd3fb243c50c5186e8edd8d8
Reviewed-on: https://gerrit.libreoffice.org/58276
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/strtmpl.cxx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx index b477e50216c0..421a615b7574 100644 --- a/sal/rtl/strtmpl.cxx +++ b/sal/rtl/strtmpl.cxx @@ -1313,16 +1313,12 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( IMPL_RTL_STRINGDATA** ppThis, SAL_THROW_EXTERN_C() { assert(ppThis); - IMPL_RTL_STRCODE* pBuffer; IMPL_RTL_STRINGDATA* pOrg; sal_Int32 nLen; if ( pCharStr ) { - const IMPL_RTL_STRCODE* pTempStr = pCharStr; - while( *pTempStr ) - pTempStr++; - nLen = pTempStr-pCharStr; + nLen = IMPL_RTL_STRNAME( getLength )( pCharStr ); } else nLen = 0; @@ -1336,15 +1332,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( newFromStr )( IMPL_RTL_STRINGDATA** ppThis, pOrg = *ppThis; *ppThis = IMPL_RTL_STRINGNAME( ImplAlloc )( nLen ); OSL_ASSERT(*ppThis != nullptr); - pBuffer = (*ppThis)->buffer; - do - { - *pBuffer = *pCharStr; - pBuffer++; - pCharStr++; - } - while ( *pCharStr ); - + rtl_str_ImplCopy( (*ppThis)->buffer, pCharStr, nLen ); RTL_LOG_STRING_NEW( *ppThis ); /* must be done last, if pCharStr == *ppThis */ |