diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-03-30 18:27:58 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-04-02 13:51:55 +0100 |
commit | 1426d4432c59ef42f28642ec63e57517223eb32d (patch) | |
tree | 75b6d769d309b2564e6a730a278e9c1c126ce777 /sal/inc | |
parent | 0f330ea25840690d05516adc20cfb3d1a9d33317 (diff) |
sal: expose more stringbuffer related instrumentation points
Avoid ref/unref pair in makeStringAndClear, hook into the
stringbuffer-like 'String' class to expose it's conversion to
immutable strings, and fixup misc. missing instrumentation.
Diffstat (limited to 'sal/inc')
-rw-r--r-- | sal/inc/rtl/ustrbuf.h | 28 | ||||
-rw-r--r-- | sal/inc/rtl/ustrbuf.hxx | 7 |
2 files changed, 31 insertions, 4 deletions
diff --git a/sal/inc/rtl/ustrbuf.h b/sal/inc/rtl/ustrbuf.h index 0863da0bda1c..1051d0db7fdc 100644 --- a/sal/inc/rtl/ustrbuf.h +++ b/sal/inc/rtl/ustrbuf.h @@ -179,6 +179,34 @@ SAL_DLLPUBLIC void SAL_CALL rtl_uStringbuffer_remove( sal_Int32 start, sal_Int32 len ); +/** + Returns an immutable rtl_uString object, while clearing the string buffer. + + This method is primarily used to allow these completed + string allocation events to be traced. + + @param ppThis The string, on that the operation should take place + @param nCapacity pointer to the capacity of the string buffer + + @since LibreOffice 3.6 + */ +SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uStringBuffer_makeStringAndClear( + /*inout*/ rtl_uString ** ppThis, + sal_Int32 *nCapacity ); + +/** + References and returns an immutable rtl_uString object, from a mutable + string-buffer object. + + This method is primarily used to allow legacy 'String' class + conversions to OUString to be accurately traced. + + @param pThis The string, on that the operation should take place + + @since LibreOffice 3.6 + */ +SAL_DLLPUBLIC rtl_uString * SAL_CALL rtl_uStringBuffer_refReturn( rtl_uString *pThis ); + #ifdef __cplusplus } #endif diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx index 99afe44b782b..02a507ce18cf 100644 --- a/sal/inc/rtl/ustrbuf.hxx +++ b/sal/inc/rtl/ustrbuf.hxx @@ -181,10 +181,9 @@ public: */ OUString makeStringAndClear() { - OUString aRet( pData ); - rtl_uString_new(&pData); - nCapacity = 0; - return aRet; + return OUString( + rtl_uStringBuffer_makeStringAndClear( &pData, &nCapacity ), + SAL_NO_ACQUIRE ); } /** |