From 81e16cea9a11185c209894973db8d1990fa9cce6 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Wed, 5 Dec 2012 00:37:01 +0100 Subject: mvoe rtl_(u)string_alloc to sal No point in hidding something useful like this in some helper lib. Change-Id: I7332d7f6bd428378cd19e7e95ad130771a541140 --- sal/inc/rtl/ustring.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'sal/inc/rtl/ustring.h') diff --git a/sal/inc/rtl/ustring.h b/sal/inc/rtl/ustring.h index 0548033f732c..fe2f2f47607d 100644 --- a/sal/inc/rtl/ustring.h +++ b/sal/inc/rtl/ustring.h @@ -1149,6 +1149,31 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uString_release( SAL_DLLPUBLIC void SAL_CALL rtl_uString_new( rtl_uString ** newStr ) SAL_THROW_EXTERN_C(); +/** Allocate a new string containing space for a given number of characters. + + The reference count of the new string will be 1. The length of the string + will be nLen. This function throws std::bad_alloc on out-of-memory + conditions. + + The characters of the capacity are not cleared, and the length is set to + nLen, unlike the similar method of rtl_uString_new_WithLength which + zeros out the buffer, and sets the length to 0. So should be somewhat + more efficient for allocating a new string. + + call rtl_uString_release to release the string + alternatively pass ownership to an OUString with + rtl::OUString(newStr, SAL_NO_ACQUIRE); + + @param newStr + pointer to the new string. + + @param len + the number of characters. + + @since LibreOffice 4.1 + */ +SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uString_alloc(sal_Int32 nLen) SAL_THROW_EXTERN_C(); + /** Allocate a new string containing space for a given number of characters. If len is greater than zero, the reference count of the new string will be -- cgit