summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-07-05 08:29:55 +0000
committerOliver Bolte <obo@openoffice.org>2004-07-05 08:29:55 +0000
commitf12318057a68e7f9c5be023921bd6d73375e6280 (patch)
tree1c710a4ec2df04386653df8b8c0adf2057eadb84 /sal
parent5f816d054ede7d20739f868f3f61078c51c1e17a (diff)
INTEGRATION: CWS vcl22 (1.16.10); FILE MERGED
2004/05/18 11:30:57 pl 1.16.10.3: RESYNC: (1.16-1.17); FILE MERGED 2004/05/14 11:55:50 hdu 1.16.10.2: #29154# streamline compare_WithLength more 2004/05/13 17:23:21 hdu 1.16.10.1: #29154# more efficent implementation of extremely oftenly used function
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/source/strtmpl.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/sal/rtl/source/strtmpl.c b/sal/rtl/source/strtmpl.c
index 9b13a5030354..6d2a573222e6 100644
--- a/sal/rtl/source/strtmpl.c
+++ b/sal/rtl/source/strtmpl.c
@@ -2,9 +2,9 @@
*
* $RCSfile: strtmpl.c,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: rt $ $Date: 2004-05-03 09:20:20 $
+ * last change: $Author: obo $ $Date: 2004-07-05 09:29:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,21 +129,18 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare_WithLength )( const IMPL_RTL_STRCOD
const IMPL_RTL_STRCODE* pStr2,
sal_Int32 nStr2Len )
{
- const IMPL_RTL_STRCODE* pStr1End = pStr1 + nStr1Len;
- const IMPL_RTL_STRCODE* pStr2End = pStr2 + nStr2Len;
- sal_Int32 nRet;
- while ( (pStr1 < pStr1End) && (pStr2 < pStr2End) )
- {
- nRet = ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr1 )))-
- ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr2 )));
- if ( nRet )
- return nRet;
+ sal_Int32 nRet = nStr1Len - nStr2Len;
+ int nCount = (nRet <= 0) ? nStr1Len : nStr2Len;
- pStr1++;
- pStr2++;
- }
+ --pStr1;
+ --pStr2;
+ while( (--nCount >= 0) && (*++pStr1 == *++pStr2) );
- return nStr1Len - nStr2Len;
+ if( nCount >= 0 )
+ nRet = ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr1 )))
+ - ((sal_Int32)(IMPL_RTL_USTRCODE( *pStr2 )));
+
+ return nRet;
}
/* ----------------------------------------------------------------------- */