diff options
author | Oleg Efimov <efimovov@gmail.com> | 2012-05-21 21:09:40 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-05-22 01:29:06 +0400 |
commit | 45de259b436ab1bbeb15d7f582f29e795f162202 (patch) | |
tree | 827b00eca41c2495d34466d2bf39c99c2daf58fa /src/pipe_wrap.cc | |
parent | 81a4edcf6afc1180b80a516db894db400ce04b1a (diff) |
Make UNWRAP macro generic.
Diffstat (limited to 'src/pipe_wrap.cc')
-rw-r--r-- | src/pipe_wrap.cc | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index f984d3bb3f4..39b21a6fab2 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -26,18 +26,6 @@ #include "stream_wrap.h" #include "pipe_wrap.h" -#define UNWRAP \ - assert(!args.Holder().IsEmpty()); \ - assert(args.Holder()->InternalFieldCount() > 0); \ - PipeWrap* wrap = \ - static_cast<PipeWrap*>(args.Holder()->GetPointerFromInternalField(0)); \ - if (!wrap) { \ - uv_err_t err; \ - err.code = UV_EBADF; \ - SetErrno(err); \ - return scope.Close(Integer::New(-1)); \ - } - namespace node { using v8::Object; @@ -149,7 +137,7 @@ PipeWrap::PipeWrap(Handle<Object> object, bool ipc) Handle<Value> PipeWrap::Bind(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(PipeWrap) String::AsciiValue name(args[0]); @@ -166,7 +154,7 @@ Handle<Value> PipeWrap::Bind(const Arguments& args) { Handle<Value> PipeWrap::SetPendingInstances(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(PipeWrap) int instances = args[0]->Int32Value(); @@ -180,7 +168,7 @@ Handle<Value> PipeWrap::SetPendingInstances(const Arguments& args) { Handle<Value> PipeWrap::Listen(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(PipeWrap) int backlog = args[0]->Int32Value(); @@ -269,7 +257,7 @@ void PipeWrap::AfterConnect(uv_connect_t* req, int status) { Handle<Value> PipeWrap::Open(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(PipeWrap) int fd = args[0]->IntegerValue(); @@ -282,7 +270,7 @@ Handle<Value> PipeWrap::Open(const Arguments& args) { Handle<Value> PipeWrap::Connect(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(PipeWrap) String::AsciiValue name(args[0]); |