Skip to content

Commit 596e2de

Browse files
committed
made syscall module compatible with node v0.11.13
1 parent 62e5038 commit 596e2de

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

node-syscall/syscall.cc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ intptr_t toNative(Local<Value> value) {
2626
return static_cast<intptr_t>(static_cast<int32_t>(value->ToInteger()->Value()));
2727
}
2828

29-
void Syscall(const v8::FunctionCallbackInfo<Value>& info) {
29+
void Syscall(const FunctionCallbackInfo<Value>& info) {
3030
int trap = info[0]->ToInteger()->Value();
3131
int r1 = 0, r2 = 0;
3232
switch (trap) {
@@ -54,14 +54,15 @@ void Syscall(const v8::FunctionCallbackInfo<Value>& info) {
5454
if (r1 < 0) {
5555
err = errno;
5656
}
57-
Local<Array> res = Array::New(3);
58-
res->Set(0, Integer::New(r1));
59-
res->Set(1, Integer::New(r2));
60-
res->Set(2, Integer::New(err));
57+
Isolate* isolate = info.GetIsolate();
58+
Local<Array> res = Array::New(isolate, 3);
59+
res->Set(0, Integer::New(isolate, r1));
60+
res->Set(1, Integer::New(isolate, r2));
61+
res->Set(2, Integer::New(isolate, err));
6162
info.GetReturnValue().Set(res);
6263
}
6364

64-
void Syscall6(const v8::FunctionCallbackInfo<Value>& info) {
65+
void Syscall6(const FunctionCallbackInfo<Value>& info) {
6566
int r = syscall(
6667
info[0]->ToInteger()->Value(),
6768
toNative(info[1]),
@@ -75,10 +76,11 @@ void Syscall6(const v8::FunctionCallbackInfo<Value>& info) {
7576
if (r < 0) {
7677
err = errno;
7778
}
78-
Local<Array> res = Array::New(3);
79-
res->Set(0, Integer::New(r));
80-
res->Set(1, Integer::New(0));
81-
res->Set(2, Integer::New(err));
79+
Isolate* isolate = info.GetIsolate();
80+
Local<Array> res = Array::New(isolate, 3);
81+
res->Set(0, Integer::New(isolate, r));
82+
res->Set(1, Integer::New(isolate, 0));
83+
res->Set(2, Integer::New(isolate, err));
8284
info.GetReturnValue().Set(res);
8385
}
8486

0 commit comments

Comments
 (0)