Browse Source

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>
v1.8.0-commit
Ben Noordhuis 10 years ago
parent
commit
4aea16f214
  1. 8
      src/util.cc

8
src/util.cc

@ -8,12 +8,12 @@ Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value)
if (value.IsEmpty())
return;
v8::Local<v8::String> val_ = value->ToString(isolate);
if (val_.IsEmpty())
v8::Local<v8::String> string = value->ToString(isolate);
if (string.IsEmpty())
return;
// 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_)) {
str_ = static_cast<char*>(malloc(len));
CHECK_NE(str_, nullptr);
@ -21,7 +21,7 @@ Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value)
const int flags =
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';
}

Loading…
Cancel
Save