[Libreoffice-commits] core.git: 2 commits - sal/rtl
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Jul 29 17:11:22 UTC 2018
sal/rtl/strtmpl.cxx | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
New commits:
commit 0955eb65b6302a072fd9b55b9cd09b62ab5dcd43
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 29 13:15:36 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 29 19:11:13 2018 +0200
Use memmove in trim_WithLength
Change-Id: If75ac1968b8b0b3314ae36c2a7f163cb5428e9c6
Reviewed-on: https://gerrit.libreoffice.org/58277
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 421a615b7574..af3a28cbfec2 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -744,18 +744,9 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( trim_WithLength )( IMPL_RTL_STRCODE* pStr,
if ( nPreSpaces )
{
- IMPL_RTL_STRCODE* pNewStr = pStr+nPreSpaces;
-
nLen -= nPreSpaces;
- nIndex = nLen;
-
- while ( nIndex )
- {
- *pStr = *pNewStr;
- pStr++;
- pNewStr++;
- nIndex--;
- }
+ memmove(pStr, pStr + nPreSpaces, nLen * sizeof(IMPL_RTL_STRCODE));
+ pStr += nLen;
*pStr = 0;
}
commit 034203742d43045df1a6a733a81fb929ee840aac
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Jul 29 13:08:26 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Jul 29 19:11:01 2018 +0200
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 at collabora.co.uk>
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 */
More information about the Libreoffice-commits
mailing list