summaryrefslogtreecommitdiffstats
path: root/sal/rtl/strtmpl.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2018-07-29 13:08:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-07-29 19:11:01 +0200
commit034203742d43045df1a6a733a81fb929ee840aac (patch)
treea885bd296624cd9fb5000b2fd5b0a0d02cd532c8 /sal/rtl/strtmpl.cxx
parentofz#7790 reduce row limit further for fuzzing (diff)
downloadcore-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/rtl/strtmpl.cxx')
-rw-r--r--sal/rtl/strtmpl.cxx16
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 */