diff options
Diffstat (limited to 'src/node_internals.h')
-rw-r--r-- | src/node_internals.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/node_internals.h b/src/node_internals.h index 8d073927b..80aa4e536 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -22,6 +22,8 @@ #ifndef SRC_NODE_INTERNALS_H_ #define SRC_NODE_INTERNALS_H_ +#include <stdlib.h> + #include "v8.h" namespace node { @@ -81,6 +83,17 @@ inline static v8::Handle<v8::Value> ThrowRangeError(const char* errmsg) { THROW_ERROR(v8::Exception::RangeError); } +#define UNWRAP(type) \ + assert(!args.Holder().IsEmpty()); \ + assert(args.Holder()->InternalFieldCount() > 0); \ + type* wrap = \ + static_cast<type*>(args.Holder()->GetPointerFromInternalField(0)); \ + if (!wrap) { \ + fprintf(stderr, #type ": Aborting due to unwrap failure at %s:%d\n", \ + __FILE__, __LINE__); \ + abort(); \ + } + } // namespace node #endif // SRC_NODE_INTERNALS_H_ |