diff options
author | Trevor Norris <trev.norris@gmail.com> | 2013-08-05 17:58:29 -0700 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2013-08-12 11:49:53 -0700 |
commit | 756ae2c5360b7ab64649cb7587242a2fbd8dc95d (patch) | |
tree | a6152c93769e654073dc9128864677a22ec41007 /src/fs_event_wrap.cc | |
parent | e0a8e1bf77e561ec6894540ea2aae6a52fb1d7e0 (diff) | |
download | node-new-756ae2c5360b7ab64649cb7587242a2fbd8dc95d.tar.gz |
src: centralize class wrap/unwrap
While almost all cases were handled by simple WRAP/UNWRAP macros, this
extends those to cover all known occurrences.
Diffstat (limited to 'src/fs_event_wrap.cc')
-rw-r--r-- | src/fs_event_wrap.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index 8c10ccac9d..9efaa99561 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -98,7 +98,8 @@ void FSEventWrap::New(const FunctionCallbackInfo<Value>& args) { void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) { HandleScope scope(node_isolate); - UNWRAP(FSEventWrap) + FSEventWrap* wrap; + UNWRAP(args.This(), FSEventWrap, wrap); if (args.Length() < 1 || !args[0]->IsString()) { return ThrowTypeError("Bad arguments"); @@ -171,13 +172,8 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) { HandleScope scope(node_isolate); - // Unwrap manually here. The UNWRAP() macro asserts that wrap != NULL. - // That usually indicates an error but not here: double closes are possible - // and legal, HandleWrap::Close() deals with them the same way. - assert(!args.This().IsEmpty()); - assert(args.This()->InternalFieldCount() > 0); - void* ptr = args.This()->GetAlignedPointerFromInternalField(0); - FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr); + FSEventWrap* wrap; + UNWRAP_NO_ABORT(args.This(), FSEventWrap, wrap); if (wrap == NULL || wrap->initialized_ == false) return; wrap->initialized_ = false; |