diff options
author | Oleg Efimov <efimovov@gmail.com> | 2012-05-21 21:09:40 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-05-21 23:29:06 +0200 |
commit | 45de259b436ab1bbeb15d7f582f29e795f162202 (patch) | |
tree | 827b00eca41c2495d34466d2bf39c99c2daf58fa /src/tty_wrap.cc | |
parent | 81a4edcf6afc1180b80a516db894db400ce04b1a (diff) | |
download | node-45de259b436ab1bbeb15d7f582f29e795f162202.tar.gz |
Make UNWRAP macro generic.
Diffstat (limited to 'src/tty_wrap.cc')
-rw-r--r-- | src/tty_wrap.cc | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index ec289899b..1a9ec5600 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -42,19 +42,6 @@ using v8::Arguments; using v8::Integer; using v8::Undefined; -#define UNWRAP \ - assert(!args.Holder().IsEmpty()); \ - assert(args.Holder()->InternalFieldCount() > 0); \ - TTYWrap* wrap = \ - static_cast<TTYWrap*>(args.Holder()->GetPointerFromInternalField(0)); \ - if (!wrap) { \ - uv_err_t err; \ - err.code = UV_EBADF; \ - SetErrno(err); \ - return scope.Close(Integer::New(-1)); \ - } - - class TTYWrap : StreamWrap { public: static void Initialize(Handle<Object> target) { @@ -122,7 +109,7 @@ class TTYWrap : StreamWrap { static Handle<Value> GetWindowSize(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(TTYWrap) int width, height; int r = uv_tty_get_winsize(&wrap->handle_, &width, &height); @@ -142,7 +129,7 @@ class TTYWrap : StreamWrap { static Handle<Value> SetRawMode(const Arguments& args) { HandleScope scope; - UNWRAP + UNWRAP(TTYWrap) int r = uv_tty_set_mode(&wrap->handle_, args[0]->IsTrue()); |