Skip to content

Commit

Permalink
src: rename confusingly named local variable
Browse files Browse the repository at this point in the history
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: #1042
Reviewed-By: Trevor Norris <[email protected]>
  • Loading branch information
bnoordhuis committed Mar 5, 2015
1 parent c9ee654 commit 4aea16f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ 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);
}

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';
}

Expand Down

0 comments on commit 4aea16f

Please sign in to comment.