diff options
Diffstat (limited to 'libs/utils/String16.cpp')
-rw-r--r-- | libs/utils/String16.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/utils/String16.cpp b/libs/utils/String16.cpp index c856ceb9b2..b09b728adf 100644 --- a/libs/utils/String16.cpp +++ b/libs/utils/String16.cpp @@ -93,6 +93,19 @@ String16::String16() { } +String16::String16(StaticLinkage) + : mString(0) +{ + // this constructor is used when we can't rely on the static-initializers + // having run. In this case we always allocate an empty string. It's less + // efficient than using getEmptyString(), but we assume it's uncommon. + + char16_t* data = static_cast<char16_t*>( + SharedBuffer::alloc(sizeof(char16_t))->data()); + data[0] = 0; + mString = data; +} + String16::String16(const String16& o) : mString(o.mString) { |