diff options
author | Trevor Norris <trev.norris@gmail.com> | 2013-10-29 12:27:24 -0700 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2013-10-29 15:09:44 -0700 |
commit | 93f75a86bf6c87aa897312740aab61282b0eff1d (patch) | |
tree | 18c33d405b8f22bfeeb1a35cba45fa3b9d9703ed /src/pipe_wrap.cc | |
parent | 4b84e42f67d7754574bf7d289524f6dffcb5e14a (diff) | |
download | node-new-93f75a86bf6c87aa897312740aab61282b0eff1d.tar.gz |
src: use function to get internal pointer
Remove the NODE_{WRAP,UNWRAP} macros and instead use template functions.
Diffstat (limited to 'src/pipe_wrap.cc')
-rw-r--r-- | src/pipe_wrap.cc | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index b0bd28dd82..4b195fda4a 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -70,9 +70,7 @@ Local<Object> PipeWrap::Instantiate(Environment* env) { PipeWrap* PipeWrap::Unwrap(Local<Object> obj) { - PipeWrap* wrap; - NODE_UNWRAP(obj, PipeWrap, wrap); - return wrap; + return UnwrapObject<PipeWrap>(obj); } @@ -146,8 +144,7 @@ PipeWrap::PipeWrap(Environment* env, Handle<Object> object, bool ipc) void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) { HandleScope scope(node_isolate); - PipeWrap* wrap; - NODE_UNWRAP(args.This(), PipeWrap, wrap); + PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This()); String::AsciiValue name(args[0]); int err = uv_pipe_bind(&wrap->handle_, *name); @@ -159,8 +156,7 @@ void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) { void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) { HandleScope scope(node_isolate); - PipeWrap* wrap; - NODE_UNWRAP(args.This(), PipeWrap, wrap); + PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This()); int instances = args[0]->Int32Value(); @@ -172,8 +168,7 @@ void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) { void PipeWrap::Listen(const FunctionCallbackInfo<Value>& args) { HandleScope scope(node_isolate); - PipeWrap* wrap; - NODE_UNWRAP(args.This(), PipeWrap, wrap); + PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This()); int backlog = args[0]->Int32Value(); int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_), @@ -215,8 +210,7 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) { env->pipe_constructor_template()->GetFunction()->NewInstance(); // Unwrap the client javascript object. - PipeWrap* wrap; - NODE_UNWRAP(client_obj, PipeWrap, wrap); + PipeWrap* wrap = UnwrapObject<PipeWrap>(client_obj); uv_stream_t* client_handle = reinterpret_cast<uv_stream_t*>(&wrap->handle_); if (uv_accept(handle, client_handle)) return; @@ -275,8 +269,7 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) { void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) { HandleScope scope(node_isolate); - PipeWrap* wrap; - NODE_UNWRAP(args.This(), PipeWrap, wrap); + PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This()); int fd = args[0]->Int32Value(); @@ -291,8 +284,7 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args.GetIsolate()); HandleScope scope(args.GetIsolate()); - PipeWrap* wrap; - NODE_UNWRAP(args.This(), PipeWrap, wrap); + PipeWrap* wrap = UnwrapObject<PipeWrap>(args.This()); assert(args[0]->IsObject()); assert(args[1]->IsString()); |