src: rename confusingly named local variable
Rename `val_` to `string`. The underscore suffix is normally reserved for data members, not locals, and it's not a great name in the first place. PR-URL: https://github.com/iojs/io.js/pull/1042 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
c9ee654290
commit
4aea16f214
@ -8,12 +8,12 @@ Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value)
|
|||||||
if (value.IsEmpty())
|
if (value.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
v8::Local<v8::String> val_ = value->ToString(isolate);
|
v8::Local<v8::String> string = value->ToString(isolate);
|
||||||
if (val_.IsEmpty())
|
if (string.IsEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Allocate enough space to include the null terminator
|
// Allocate enough space to include the null terminator
|
||||||
size_t len = StringBytes::StorageSize(val_, UTF8) + 1;
|
size_t len = StringBytes::StorageSize(string, UTF8) + 1;
|
||||||
if (len > sizeof(str_st_)) {
|
if (len > sizeof(str_st_)) {
|
||||||
str_ = static_cast<char*>(malloc(len));
|
str_ = static_cast<char*>(malloc(len));
|
||||||
CHECK_NE(str_, nullptr);
|
CHECK_NE(str_, nullptr);
|
||||||
@ -21,7 +21,7 @@ Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value)
|
|||||||
|
|
||||||
const int flags =
|
const int flags =
|
||||||
v8::String::NO_NULL_TERMINATION | v8::String::REPLACE_INVALID_UTF8;
|
v8::String::NO_NULL_TERMINATION | v8::String::REPLACE_INVALID_UTF8;
|
||||||
length_ = val_->WriteUtf8(str_, len, 0, flags);
|
length_ = string->WriteUtf8(str_, len, 0, flags);
|
||||||
str_[length_] = '\0';
|
str_[length_] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user