diff options
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r-- | src/node_buffer.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 10ddbaf72..434bc547a 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -127,18 +127,12 @@ size_t Buffer::Length(Handle<Object> obj) { Handle<Value> Buffer::New(const Arguments &args) { - HandleScope scope; - if (!args.IsConstructCall()) { - Local<Value> argv[10]; - for (int i = 0; i < MIN(args.Length(), 10); i++) { - argv[i] = args[i]; - } - Local<Object> instance = - constructor_template->GetFunction()->NewInstance(args.Length(), argv); - return scope.Close(instance); + return FromConstructorTemplate(constructor_template, args); } + HandleScope scope; + Buffer *buffer; if (args[0]->IsInt32()) { // var buffer = new Buffer(1024); |