diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-12-05 00:55:13 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-12-06 13:35:18 +0100 |
commit | 9b7ec76111ed966e93f6e0802aa6c8e021dcd4a8 (patch) | |
tree | 7114c68e0774d0c68228ae6c80405a5643945707 /sal | |
parent | 81e16cea9a11185c209894973db8d1990fa9cce6 (diff) |
use rtl_(u)string_alloc where the contents clearly don't need to be cleared
Change-Id: I3e8d8f123aaa43ee3721fae6f220a8c5f959a0ea
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/strbuf.hxx | 8 | ||||
-rw-r--r-- | sal/inc/rtl/string.hxx | 9 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 10 | ||||
-rw-r--r-- | sal/inc/rtl/ustring.hxx | 11 |
4 files changed, 16 insertions, 22 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx index 90204f0fca18..86f89efbf86f 100644 --- a/sal/inc/rtl/strbuf.hxx +++ b/sal/inc/rtl/strbuf.hxx @@ -233,13 +233,11 @@ public: OStringBuffer( const OStringConcat< T1, T2 >& c ) { const sal_Int32 l = c.length(); - rtl_String* buffer = NULL; nCapacity = l + 16; - rtl_string_new_WithLength( &buffer, nCapacity ); - char* end = c.addData( buffer->buffer ); + pData = rtl_string_alloc( nCapacity ); + char* end = c.addData( pData->buffer ); *end = '\0'; - buffer->length = end - buffer->buffer; - pData = buffer; + pData->length = end - pData->buffer; } #endif diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx index 1ef086025f85..8e33973729d7 100644 --- a/sal/inc/rtl/string.hxx +++ b/sal/inc/rtl/string.hxx @@ -265,14 +265,13 @@ public: OString( const OStringConcat< T1, T2 >& c ) { const sal_Int32 l = c.length(); - rtl_String* buffer = NULL; - rtl_string_new_WithLength( &buffer, l ); + pData = rtl_string_alloc( l ); if (l != 0) { - char* end = c.addData( buffer->buffer ); - buffer->length = end - buffer->buffer; + char* end = c.addData( pData->buffer ); + pData->length = end - pData->buffer; + *end = '\0'; } - pData = buffer; } #endif diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index 9549414d44d4..c5c6f5d54337 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -225,14 +225,12 @@ public: OUStringBuffer( const OUStringConcat< T1, T2 >& c ) { const sal_Int32 l = c.length(); - rtl_uString* buffer = NULL; nCapacity = l + 16; - rtl_uString_new_WithLength( &buffer, nCapacity ); // TODO this clears, not necessary - sal_Unicode* end = c.addData( buffer->buffer ); + pData = rtl_uString_alloc( nCapacity ); + sal_Unicode* end = c.addData( pData->buffer ); *end = '\0'; - buffer->length = end - buffer->buffer; - // TODO realloc in case buffer->length is noticeably smaller than l ? - pData = buffer; + pData->length = end - pData->buffer; + // TODO realloc in case pData->>length is noticeably smaller than l ? } #endif /** Assign to this a copy of value. diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx index 07294f47fa3e..bd1b9cb9f37e 100644 --- a/sal/inc/rtl/ustring.hxx +++ b/sal/inc/rtl/ustring.hxx @@ -333,15 +333,14 @@ public: OUString( const OUStringConcat< T1, T2 >& c ) { const sal_Int32 l = c.length(); - rtl_uString* buffer = NULL; - rtl_uString_new_WithLength( &buffer, l ); // TODO this clears, not necessary + pData = rtl_uString_alloc( l ); if (l != 0) { - sal_Unicode* end = c.addData( buffer->buffer ); - buffer->length = end - buffer->buffer; - // TODO realloc in case buffer->length is noticeably smaller than l? + sal_Unicode* end = c.addData( pData->buffer ); + pData->length = end - pData->buffer; + *end = '\0'; + // TODO realloc in case pData->length is noticeably smaller than l? } - pData = buffer; } #endif |