| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index bb9334f92b4849e3ff4e40c8f7934707bfc5d433..d44ccb84d6ba9496209ba9034752084fabcacb51 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -21209,29 +21209,7 @@ RawString* String::SubString(Thread* thread,
|
|
|
|
|
| const char* String::ToCString() const {
|
| - if (IsOneByteString()) {
|
| - // Quick conversion if OneByteString contains only ASCII characters.
|
| - intptr_t len = Length();
|
| - if (len == 0) {
|
| - return "";
|
| - }
|
| - Zone* zone = Thread::Current()->zone();
|
| - uint8_t* result = zone->Alloc<uint8_t>(len + 1);
|
| - NoSafepointScope no_safepoint;
|
| - const uint8_t* original_str = OneByteString::CharAddr(*this, 0);
|
| - for (intptr_t i = 0; i < len; i++) {
|
| - if (original_str[i] <= Utf8::kMaxOneByteChar) {
|
| - result[i] = original_str[i];
|
| - } else {
|
| - len = -1;
|
| - break;
|
| - }
|
| - }
|
| - if (len > 0) {
|
| - result[len] = 0;
|
| - return reinterpret_cast<const char*>(result);
|
| - }
|
| - }
|
| + NoSafepointScope no_safepoint;
|
| const intptr_t len = Utf8::Length(*this);
|
| Zone* zone = Thread::Current()->zone();
|
| uint8_t* result = zone->Alloc<uint8_t>(len + 1);
|
|
|