Kaydet (Commit) 7ba33735 authored tarafından Caolán McNamara's avatar Caolán McNamara

merge these similar methods together

üst 050b80a6
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment