From 1e99486cc83d0e3c41de37c924150f2853870902 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 4 Sep 2014 04:23:03 +0200 Subject: [PATCH] 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 --- src/util-inl.h | 4 ++++ src/util.h | 2 ++ 2 files changed, 6 insertions(+) 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 object, TypeName* pointer) { object->SetAlignedPointerInInternalField(0, pointer); } +void ClearWrap(v8::Local object) { + Wrap(object, NULL); +} + template TypeName* Unwrap(v8::Local 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 OneByteString(v8::Isolate* isolate, inline void Wrap(v8::Local object, void* pointer); +inline void ClearWrap(v8::Local object); + template inline TypeName* Unwrap(v8::Local object);