Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-09-04 06:23:03 +0400
committerTrevor Norris <trev.norris@gmail.com>2014-09-05 20:33:58 +0400
commit1e99486cc83d0e3c41de37c924150f2853870902 (patch)
treebe1984c3d777c32d6ed19c88999f2ca4629895a5
parentde9a444ab4c1219d36578b9594aee3d039564c3e (diff)
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.h4
-rw-r--r--src/util.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/src/util-inl.h b/src/util-inl.h
index 3709208f168..045a27796dd 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 f547a085272..4f0de82d568 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);