Skip to content

Commit b8a7eed

Browse files
committed
process_wrap: omit superfluous Number creation
Don't create a superfluous Number object, just use the version of v8::Object::Get() that takes an unsigned int. Convert the index to unsigned int while we're here.
1 parent 45d056e commit b8a7eed

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/process_wrap.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ class ProcessWrap : public HandleWrap {
8686
uv_process_options_t* options) {
8787
Local<Array> stdios = js_options
8888
->Get(String::NewSymbol("stdio")).As<Array>();
89-
int len = stdios->Length();
89+
uint32_t len = stdios->Length();
9090
options->stdio = new uv_stdio_container_t[len];
9191
options->stdio_count = len;
9292

93-
for (int i = 0; i < len; i++) {
94-
Local<Object> stdio = stdios
95-
->Get(Number::New(static_cast<double>(i))).As<Object>();
93+
for (uint32_t i = 0; i < len; i++) {
94+
Local<Object> stdio = stdios->Get(i).As<Object>();
9695
Local<Value> type = stdio->Get(String::NewSymbol("type"));
9796

9897
if (type->Equals(String::NewSymbol("ignore"))) {

0 commit comments

Comments
 (0)