Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 91946417719a56490131ce34e77346d1fbbb05f0..fee0daf1e35f2695267022ed67f0ac39f3f7986d 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -4852,26 +4852,19 @@ void Isolate::Exit() { |
} |
-String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) { |
+String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj) |
+ : str_(NULL), length_(0) { |
i::Isolate* isolate = i::Isolate::Current(); |
if (IsDeadCheck(isolate, "v8::String::Utf8Value::Utf8Value()")) return; |
- if (obj.IsEmpty()) { |
- str_ = NULL; |
- length_ = 0; |
- return; |
- } |
+ if (obj.IsEmpty()) return; |
ENTER_V8(isolate); |
i::HandleScope scope(isolate); |
TryCatch try_catch; |
Handle<String> str = obj->ToString(); |
- if (str.IsEmpty()) { |
- str_ = NULL; |
- length_ = 0; |
- } else { |
- length_ = str->Utf8Length(); |
- str_ = i::NewArray<char>(length_ + 1); |
- str->WriteUtf8(str_); |
- } |
+ if (str.IsEmpty()) return; |
+ length_ = str->Utf8Length(); |
+ str_ = i::NewArray<char>(length_ + 1); |
+ str->WriteUtf8(str_); |
} |
@@ -4880,26 +4873,19 @@ String::Utf8Value::~Utf8Value() { |
} |
-String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) { |
+String::AsciiValue::AsciiValue(v8::Handle<v8::Value> obj) |
+ : str_(NULL), length_(0) { |
i::Isolate* isolate = i::Isolate::Current(); |
if (IsDeadCheck(isolate, "v8::String::AsciiValue::AsciiValue()")) return; |
- if (obj.IsEmpty()) { |
- str_ = NULL; |
- length_ = 0; |
- return; |
- } |
+ if (obj.IsEmpty()) return; |
ENTER_V8(isolate); |
i::HandleScope scope(isolate); |
TryCatch try_catch; |
Handle<String> str = obj->ToString(); |
- if (str.IsEmpty()) { |
- str_ = NULL; |
- length_ = 0; |
- } else { |
- length_ = str->Length(); |
- str_ = i::NewArray<char>(length_ + 1); |
- str->WriteAscii(str_); |
- } |
+ if (str.IsEmpty()) return; |
+ length_ = str->Length(); |
+ str_ = i::NewArray<char>(length_ + 1); |
+ str->WriteAscii(str_); |
} |
@@ -4908,26 +4894,19 @@ String::AsciiValue::~AsciiValue() { |
} |
-String::Value::Value(v8::Handle<v8::Value> obj) { |
+String::Value::Value(v8::Handle<v8::Value> obj) |
+ : str_(NULL), length_(0) { |
i::Isolate* isolate = i::Isolate::Current(); |
if (IsDeadCheck(isolate, "v8::String::Value::Value()")) return; |
- if (obj.IsEmpty()) { |
- str_ = NULL; |
- length_ = 0; |
- return; |
- } |
+ if (obj.IsEmpty()) return; |
ENTER_V8(isolate); |
i::HandleScope scope(isolate); |
TryCatch try_catch; |
Handle<String> str = obj->ToString(); |
- if (str.IsEmpty()) { |
- str_ = NULL; |
- length_ = 0; |
- } else { |
- length_ = str->Length(); |
- str_ = i::NewArray<uint16_t>(length_ + 1); |
- str->Write(str_); |
- } |
+ if (str.IsEmpty()) return; |
+ length_ = str->Length(); |
+ str_ = i::NewArray<uint16_t>(length_ + 1); |
+ str->Write(str_); |
} |