Kaydet (Commit) 54bc0305 authored tarafından Michael Meeks's avatar Michael Meeks

sal: reduce allocation thrash in URI encode / decode

This saves 1% of string allocation / destruction on startup.
üst 54a1a175
...@@ -609,8 +609,8 @@ void SAL_CALL rtl_uriEncode(rtl_uString * pText, sal_Bool const * pCharClass, ...@@ -609,8 +609,8 @@ void SAL_CALL rtl_uriEncode(rtl_uString * pText, sal_Bool const * pCharClass,
sal_Unicode const * p = pText->buffer; sal_Unicode const * p = pText->buffer;
sal_Unicode const * pEnd = p + pText->length; sal_Unicode const * pEnd = p + pText->length;
sal_Int32 nCapacity = 0; sal_Int32 nCapacity = pText->length;
rtl_uString_new(pResult); rtl_uString_new_WithLength(pResult, nCapacity);
while (p < pEnd) while (p < pEnd)
{ {
EscapeType eType; EscapeType eType;
...@@ -676,8 +676,8 @@ void SAL_CALL rtl_uriDecode(rtl_uString * pText, ...@@ -676,8 +676,8 @@ void SAL_CALL rtl_uriDecode(rtl_uString * pText,
{ {
sal_Unicode const * p = pText->buffer; sal_Unicode const * p = pText->buffer;
sal_Unicode const * pEnd = p + pText->length; sal_Unicode const * pEnd = p + pText->length;
sal_Int32 nCapacity = 0; sal_Int32 nCapacity = pText->length;
rtl_uString_new(pResult); rtl_uString_new_WithLength(pResult, nCapacity);
while (p < pEnd) while (p < pEnd)
{ {
EscapeType eType; EscapeType eType;
......
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