summaryrefslogtreecommitdiff
path: root/sal/inc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-12-04 11:20:22 +0100
committerStephan Bergmann <sbergman@redhat.com>2012-12-04 11:20:22 +0100
commit4e593d047b9c10de085dffa3fa3dd4602361c407 (patch)
tree4e8d64663c5292a1c0e2964229304e3826886a23 /sal/inc
parent94ff635f806536b358731d046b7d9e6ce48eb0a2 (diff)
Fix fast concat of empty strings
Change-Id: Ice9c6974f44be3bc4c9b3533de2a9beb5b146ca5
Diffstat (limited to 'sal/inc')
-rw-r--r--sal/inc/rtl/string.hxx7
-rw-r--r--sal/inc/rtl/ustring.hxx9
2 files changed, 11 insertions, 5 deletions
diff --git a/sal/inc/rtl/string.hxx b/sal/inc/rtl/string.hxx
index 2c7a43dba897..aeb752890d1f 100644
--- a/sal/inc/rtl/string.hxx
+++ b/sal/inc/rtl/string.hxx
@@ -262,8 +262,11 @@ public:
const int l = c.length();
rtl_String* buffer = NULL;
rtl_string_new_WithLength( &buffer, l );
- char* end = c.addData( buffer->buffer );
- buffer->length = end - buffer->buffer;
+ if (l != 0)
+ {
+ char* end = c.addData( buffer->buffer );
+ buffer->length = end - buffer->buffer;
+ }
pData = buffer;
}
#endif
diff --git a/sal/inc/rtl/ustring.hxx b/sal/inc/rtl/ustring.hxx
index 534bd889f05a..ec9f90ecd46f 100644
--- a/sal/inc/rtl/ustring.hxx
+++ b/sal/inc/rtl/ustring.hxx
@@ -330,9 +330,12 @@ public:
const int l = c.length();
rtl_uString* buffer = NULL;
rtl_uString_new_WithLength( &buffer, l ); // TODO this clears, not necessary
- sal_Unicode* end = c.addData( buffer->buffer );
- buffer->length = end - buffer->buffer;
- // TODO realloc in case buffer->length is noticeably smaller than 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?
+ }
pData = buffer;
}
#endif