summaryrefslogtreecommitdiff
path: root/sal/rtl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-12-19 15:36:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-19 15:46:35 +0100
commit80131c795f1f9e9fcfb5a85243fb8585b083f8b1 (patch)
tree66e2e980e5d5868abd29a845c122d2e37f1addbc /sal/rtl
parent89de0181ffe2f94ea0b27bbd9da76bafa5ad1455 (diff)
IMPL_RTL_INTERN -> IMPL_RTL_IS_USTRING
Change-Id: I9793f697f14118340bc6db89540fe50ad0b8ccbd
Diffstat (limited to 'sal/rtl')
-rw-r--r--sal/rtl/string.cxx3
-rw-r--r--sal/rtl/strtmpl.cxx26
-rw-r--r--sal/rtl/ustring.cxx4
3 files changed, 15 insertions, 18 deletions
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index 07e3e946c570..259906c47c73 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -55,6 +55,9 @@ static rtl_String const aImplEmpty_rtl_String =
* the strtmpl.cxx just below, used to share code between here and
* ustring.cxx
*/
+
+#define IMPL_RTL_IS_USTRING false
+
#define IMPL_RTL_STRCODE sal_Char
#define IMPL_RTL_USTRCODE( c ) ((unsigned char)c)
#define IMPL_RTL_STRNAME( n ) rtl_str_ ## n
diff --git a/sal/rtl/strtmpl.cxx b/sal/rtl/strtmpl.cxx
index 71a2fb2a1e9e..07258b6a90ed 100644
--- a/sal/rtl/strtmpl.cxx
+++ b/sal/rtl/strtmpl.cxx
@@ -62,8 +62,7 @@ static inline void rtl_str_ImplCopy( IMPL_RTL_STRCODE* _pDest,
sal_Int32 SAL_CALL IMPL_RTL_STRNAME( getLength )( const IMPL_RTL_STRCODE* pStr )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
return strlen( pStr);
#else
@@ -88,8 +87,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare )( const IMPL_RTL_STRCODE* pStr1,
const IMPL_RTL_STRCODE* pStr2 )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
return strcmp( pStr1, pStr2);
#else
@@ -122,8 +120,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( compare_WithLength )( const IMPL_RTL_STRCOD
sal_Int32 nStr2Len )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
sal_Int32 nMin = std::min(nStr1Len, nStr2Len);
sal_Int32 nRet = strncmp(pStr1, pStr2, nMin);
@@ -163,8 +160,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( shortenedCompare_WithLength )( const IMPL_R
sal_Int32 nShortenedLength )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
sal_Int32 nMin = std::min(std::min(nStr1Len, nStr2Len), nShortenedLength);
sal_Int32 nRet = strncmp(pStr1, pStr2, nMin);
@@ -336,8 +332,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar )( const IMPL_RTL_STRCODE* pStr
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
const IMPL_RTL_STRCODE* p = strchr(pStr, c);
return p ? p - pStr : -1;
@@ -371,8 +366,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfChar_WithLength )( const IMPL_RTL_ST
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
IMPL_RTL_STRCODE* p = (IMPL_RTL_STRCODE*) memchr(pStr, c, nLen);
return p ? p - pStr : -1;
@@ -397,8 +391,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( lastIndexOfChar )( const IMPL_RTL_STRCODE*
IMPL_RTL_STRCODE c )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
const IMPL_RTL_STRCODE* p = strrchr(pStr, c);
return p ? p - pStr : -1;
@@ -442,8 +435,7 @@ sal_Int32 SAL_CALL IMPL_RTL_STRNAME( indexOfStr )( const IMPL_RTL_STRCODE* pStr,
const IMPL_RTL_STRCODE* pSubStr )
SAL_THROW_EXTERN_C()
{
-// same as "if sal_Char mode"
-#ifndef IMPL_RTL_INTERN
+#if !IMPL_RTL_IS_USTRING
// take advantage of builtin optimisations
const IMPL_RTL_STRCODE* p = strstr(pStr, pSubStr);
return p ? p - pStr : -1;
@@ -1177,7 +1169,7 @@ void SAL_CALL IMPL_RTL_STRINGNAME( release )( IMPL_RTL_STRINGDATA* pThis )
return;
/* OString doesn't have an 'intern' */
-#ifdef IMPL_RTL_INTERN
+#if IMPL_RTL_IS_USTRING
if (SAL_STRING_IS_INTERN (pThis))
{
internRelease (pThis);
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index b3eeac13226c..26aa5d9d7f89 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -62,6 +62,8 @@ static rtl_uString const aImplEmpty_rtl_uString =
* string.cxx
*/
+#define IMPL_RTL_IS_USTRING true
+
#define IMPL_RTL_STRCODE sal_Unicode
#define IMPL_RTL_USTRCODE( c ) (c)
#define IMPL_RTL_STRNAME( n ) rtl_ustr_ ## n
@@ -69,7 +71,7 @@ static rtl_uString const aImplEmpty_rtl_uString =
#define IMPL_RTL_STRINGNAME( n ) rtl_uString_ ## n
#define IMPL_RTL_STRINGDATA rtl_uString
#define IMPL_RTL_EMPTYSTRING aImplEmpty_rtl_uString
-#define IMPL_RTL_INTERN
+
static void internRelease (rtl_uString *pThis);
#if USE_SDT_PROBES