diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-23 01:18:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-23 10:35:45 +0100 |
commit | 7ba337359eaf76b73dfa7828e9efe8850257f9ce (patch) | |
tree | b8a668617faa641a09f6fb8c24b83e0296e8c263 /i18nutil | |
parent | 050b80a6fc9b6f0c550c5ca20fa3c93e9552c13a (diff) |
merge these similar methods together
Diffstat (limited to 'i18nutil')
-rw-r--r-- | i18nutil/inc/i18nutil/x_rtl_ustring.h | 25 | ||||
-rw-r--r-- | i18nutil/source/utility/widthfolding.cxx | 3 |
2 files changed, 10 insertions, 18 deletions
diff --git a/i18nutil/inc/i18nutil/x_rtl_ustring.h b/i18nutil/inc/i18nutil/x_rtl_ustring.h index 6b644afd1691..848cc9e5eb6e 100644 --- a/i18nutil/inc/i18nutil/x_rtl_ustring.h +++ b/i18nutil/inc/i18nutil/x_rtl_ustring.h @@ -28,30 +28,23 @@ #ifndef INCLUDED_I18NUTIL_X_RTL_USTRING_H #define INCLUDED_I18NUTIL_X_RTL_USTRING_H -#ifndef _RTL_STRING_HXX_ #include <rtl/strbuf.hxx> -#endif #include <rtl/memory.h> #include <rtl/alloc.h> #include "i18nutildllapi.h" /** - * Allocates a new <code>rtl_uString</code> which can hold nLen + 1 characters. - * The reference count is 0. The characters of room is not cleared. - * This method is similar to rtl_uString_new_WithLength in rtl/ustring.h, but - * can allocate a new string more efficiently. You need to "acquire" by such as - * OUString( rtl_uString * value ) if you intend to use it for a while. - * @param [output] newStr - * @param [input] nLen + * Allocates a new <code>rtl_uString</code> with capacity of nLen + 1 + * characters. + * + * The reference count is 0. The characters of the capacity are not cleared, + * unlike the similar method of rtl_uString_new_WithLength in rtl/ustring.h, so + * is more efficient for allocating a new string. You need to "acquire" by such + * as OUString( rtl_uString * value ) if you intend to use it for a while. + * @param nLen + * @return newStr */ -I18NUTIL_DLLPUBLIC inline void SAL_CALL x_rtl_uString_new_WithLength( rtl_uString ** newStr, sal_Int32 nLen, sal_Int32 _refCount = 0 ) -{ - *newStr = (rtl_uString*) rtl_allocateMemory ( sizeof(rtl_uString) + sizeof(sal_Unicode) * nLen); - (*newStr)->refCount = _refCount; - (*newStr)->length = nLen; -} - I18NUTIL_DLLPUBLIC inline rtl_uString * SAL_CALL x_rtl_uString_new_WithLength( sal_Int32 nLen, sal_Int32 _refCount = 0 ) { rtl_uString *newStr = (rtl_uString*) rtl_allocateMemory ( sizeof(rtl_uString) + sizeof(sal_Unicode) * nLen); diff --git a/i18nutil/source/utility/widthfolding.cxx b/i18nutil/source/utility/widthfolding.cxx index 1152d9e59bf2..ed636b2e5cc4 100644 --- a/i18nutil/source/utility/widthfolding.cxx +++ b/i18nutil/source/utility/widthfolding.cxx @@ -55,8 +55,7 @@ OUString widthfolding::decompose_ja_voiced_sound_marks (const OUString& inStr, s { // Create a string buffer which can hold nCount * 2 + 1 characters. // Its size may become double of nCount. - rtl_uString * newStr; - x_rtl_uString_new_WithLength( &newStr, nCount * 2 ); // defined in x_rtl_ustring.h The reference count is 0 now. + rtl_uString * newStr = x_rtl_uString_new_WithLength(nCount * 2 ); // defined in x_rtl_ustring.h The reference count is 0 now. sal_Int32 *p = NULL; sal_Int32 position = 0; |