diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-09-04 04:23:03 +0200 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2014-09-05 09:33:58 -0700 |
commit | 1e99486cc83d0e3c41de37c924150f2853870902 (patch) | |
tree | be1984c3d777c32d6ed19c88999f2ca4629895a5 | |
parent | de9a444ab4c1219d36578b9594aee3d039564c3e (diff) | |
download | nodejs-1e99486cc83d0e3c41de37c924150f2853870902.tar.gz nodejs-1e99486cc83d0e3c41de37c924150f2853870902.tar.bz2 nodejs-1e99486cc83d0e3c41de37c924150f2853870902.zip |
src: add ClearWrap() to util.h
Counterpart to Wrap(), clears the previously assigned internal field.
Will be used in an upcoming commit.
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
-rw-r--r-- | src/util-inl.h | 4 | ||||
-rw-r--r-- | src/util.h | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/util-inl.h b/src/util-inl.h index 3709208f1..045a27796 100644 --- a/src/util-inl.h +++ b/src/util-inl.h @@ -107,6 +107,10 @@ void Wrap(v8::Local<v8::Object> object, TypeName* pointer) { object->SetAlignedPointerInInternalField(0, pointer); } +void ClearWrap(v8::Local<v8::Object> object) { + Wrap<void>(object, NULL); +} + template <typename TypeName> TypeName* Unwrap(v8::Local<v8::Object> object) { assert(!object.IsEmpty()); diff --git a/src/util.h b/src/util.h index f547a0852..4f0de82d5 100644 --- a/src/util.h +++ b/src/util.h @@ -112,6 +112,8 @@ inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate, inline void Wrap(v8::Local<v8::Object> object, void* pointer); +inline void ClearWrap(v8::Local<v8::Object> object); + template <typename TypeName> inline TypeName* Unwrap(v8::Local<v8::Object> object); |