Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
src: fix build break from generic macro name
Browse files Browse the repository at this point in the history
WRAP is too generic a macro name and causes the build to fail from
conflicts. They have been prepended with NODE_.
  • Loading branch information
trevnorris committed Aug 12, 2013
1 parent 5725864 commit 35f789b
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 78 deletions.
4 changes: 2 additions & 2 deletions src/fs_event_wrap.cc
Expand Up @@ -99,7 +99,7 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

FSEventWrap* wrap;
UNWRAP(args.This(), FSEventWrap, wrap);
NODE_UNWRAP(args.This(), FSEventWrap, wrap);

if (args.Length() < 1 || !args[0]->IsString()) {
return ThrowTypeError("Bad arguments");
Expand Down Expand Up @@ -173,7 +173,7 @@ void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

FSEventWrap* wrap;
UNWRAP_NO_ABORT(args.This(), FSEventWrap, wrap);
NODE_UNWRAP_NO_ABORT(args.This(), FSEventWrap, wrap);

if (wrap == NULL || wrap->initialized_ == false) return;
wrap->initialized_ = false;
Expand Down
8 changes: 4 additions & 4 deletions src/handle_wrap.cc
Expand Up @@ -42,7 +42,7 @@ void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

HandleWrap* wrap;
UNWRAP_NO_ABORT(args.This(), HandleWrap, wrap);
NODE_UNWRAP_NO_ABORT(args.This(), HandleWrap, wrap);

if (wrap != NULL && wrap->handle__ != NULL) {
uv_ref(wrap->handle__);
Expand All @@ -55,7 +55,7 @@ void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

HandleWrap* wrap;
UNWRAP_NO_ABORT(args.This(), HandleWrap, wrap);
NODE_UNWRAP_NO_ABORT(args.This(), HandleWrap, wrap);

if (wrap != NULL && wrap->handle__ != NULL) {
uv_unref(wrap->handle__);
Expand All @@ -68,7 +68,7 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

HandleWrap* wrap;
UNWRAP(args.This(), HandleWrap, wrap);
NODE_UNWRAP(args.This(), HandleWrap, wrap);

// guard against uninitialized handle or double close
if (wrap == NULL || wrap->handle__ == NULL) return;
Expand All @@ -95,7 +95,7 @@ HandleWrap::HandleWrap(Handle<Object> object, uv_handle_t* h) {
HandleScope scope(node_isolate);
assert(persistent().IsEmpty());
persistent().Reset(node_isolate, object);
WRAP(object, this);
NODE_WRAP(object, this);
QUEUE_INSERT_TAIL(&handle_wrap_queue, &handle_wrap_queue_);
}

Expand Down
4 changes: 2 additions & 2 deletions src/node_crypto.cc
Expand Up @@ -760,7 +760,7 @@ void SecureContext::GetTicketKeys(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

SecureContext* wrap;
UNWRAP(args.This(), SecureContext, wrap);
NODE_UNWRAP(args.This(), SecureContext, wrap);

Local<Object> buff = Buffer::New(48);
if (SSL_CTX_get_tlsext_ticket_keys(wrap->ctx_,
Expand All @@ -785,7 +785,7 @@ void SecureContext::SetTicketKeys(const FunctionCallbackInfo<Value>& args) {
}

SecureContext* wrap;
UNWRAP(args.This(), SecureContext, wrap);
NODE_UNWRAP(args.This(), SecureContext, wrap);

if (SSL_CTX_set_tlsext_ticket_keys(wrap->ctx_,
Buffer::Data(args[0]),
Expand Down
6 changes: 3 additions & 3 deletions src/node_internals.h
Expand Up @@ -207,15 +207,15 @@ inline static void ThrowUVException(int errorno,

NO_RETURN void FatalError(const char* location, const char* message);

#define WRAP(Object, Pointer) \
#define NODE_WRAP(Object, Pointer) \
do { \
assert(!Object.IsEmpty()); \
assert(Object->InternalFieldCount() > 0); \
Object->SetAlignedPointerInInternalField(0, Pointer); \
} \
while (0)

#define UNWRAP(Object, TypeName, Var) \
#define NODE_UNWRAP(Object, TypeName, Var) \
do { \
assert(!Object.IsEmpty()); \
assert(Object->InternalFieldCount() > 0); \
Expand All @@ -229,7 +229,7 @@ NO_RETURN void FatalError(const char* location, const char* message);
} \
while (0)

#define UNWRAP_NO_ABORT(Object, TypeName, Var) \
#define NODE_UNWRAP_NO_ABORT(Object, TypeName, Var) \
do { \
assert(!Object.IsEmpty()); \
assert(Object->InternalFieldCount() > 0); \
Expand Down
14 changes: 7 additions & 7 deletions src/pipe_wrap.cc
Expand Up @@ -67,7 +67,7 @@ Local<Object> PipeWrap::Instantiate() {

PipeWrap* PipeWrap::Unwrap(Local<Object> obj) {
PipeWrap* wrap;
UNWRAP(obj, PipeWrap, wrap);
NODE_UNWRAP(obj, PipeWrap, wrap);
return wrap;
}

Expand Down Expand Up @@ -146,7 +146,7 @@ void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

PipeWrap* wrap;
UNWRAP(args.This(), PipeWrap, wrap);
NODE_UNWRAP(args.This(), PipeWrap, wrap);

String::AsciiValue name(args[0]);
int err = uv_pipe_bind(&wrap->handle_, *name);
Expand All @@ -159,7 +159,7 @@ void PipeWrap::SetPendingInstances(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

PipeWrap* wrap;
UNWRAP(args.This(), PipeWrap, wrap);
NODE_UNWRAP(args.This(), PipeWrap, wrap);

int instances = args[0]->Int32Value();

Expand All @@ -172,7 +172,7 @@ void PipeWrap::Listen(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

PipeWrap* wrap;
UNWRAP(args.This(), PipeWrap, wrap);
NODE_UNWRAP(args.This(), PipeWrap, wrap);

int backlog = args[0]->Int32Value();
int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_),
Expand Down Expand Up @@ -208,7 +208,7 @@ void PipeWrap::OnConnection(uv_stream_t* handle, int status) {

// Unwrap the client javascript object.
PipeWrap* wrap;
UNWRAP(client_obj, PipeWrap, wrap);
NODE_UNWRAP(client_obj, PipeWrap, wrap);
uv_stream_t* client_handle = reinterpret_cast<uv_stream_t*>(&wrap->handle_);
if (uv_accept(handle, client_handle))
return;
Expand Down Expand Up @@ -263,7 +263,7 @@ void PipeWrap::Open(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

PipeWrap* wrap;
UNWRAP(args.This(), PipeWrap, wrap);
NODE_UNWRAP(args.This(), PipeWrap, wrap);

int fd = args[0]->IntegerValue();

Expand All @@ -275,7 +275,7 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

PipeWrap* wrap;
UNWRAP(args.This(), PipeWrap, wrap);
NODE_UNWRAP(args.This(), PipeWrap, wrap);

assert(args[0]->IsObject());
assert(args[1]->IsString());
Expand Down
4 changes: 2 additions & 2 deletions src/process_wrap.cc
Expand Up @@ -129,7 +129,7 @@ class ProcessWrap : public HandleWrap {
HandleScope scope(node_isolate);

ProcessWrap* wrap;
UNWRAP(args.This(), ProcessWrap, wrap);
NODE_UNWRAP(args.This(), ProcessWrap, wrap);

Local<Object> js_options = args[0]->ToObject();

Expand Down Expand Up @@ -258,7 +258,7 @@ class ProcessWrap : public HandleWrap {
static void Kill(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
ProcessWrap* wrap;
UNWRAP(args.This(), ProcessWrap, wrap);
NODE_UNWRAP(args.This(), ProcessWrap, wrap);

int signal = args[0]->Int32Value();
int err = uv_process_kill(&wrap->process_, signal);
Expand Down
4 changes: 2 additions & 2 deletions src/signal_wrap.cc
Expand Up @@ -83,7 +83,7 @@ class SignalWrap : public HandleWrap {
static void Start(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
SignalWrap* wrap;
UNWRAP(args.This(), SignalWrap, wrap);
NODE_UNWRAP(args.This(), SignalWrap, wrap);

int signum = args[0]->Int32Value();
int err = uv_signal_start(&wrap->handle_, OnSignal, signum);
Expand All @@ -93,7 +93,7 @@ class SignalWrap : public HandleWrap {
static void Stop(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
SignalWrap* wrap;
UNWRAP(args.This(), SignalWrap, wrap);
NODE_UNWRAP(args.This(), SignalWrap, wrap);

int err = uv_signal_stop(&wrap->handle_);
args.GetReturnValue().Set(err);
Expand Down
18 changes: 9 additions & 9 deletions src/stream_wrap.cc
Expand Up @@ -81,7 +81,7 @@ void StreamWrap::GetFD(Local<String>, const PropertyCallbackInfo<Value>& args) {
#if !defined(_WIN32)
HandleScope scope(node_isolate);
StreamWrap* wrap;
UNWRAP_NO_ABORT(args.This(), StreamWrap, wrap);
NODE_UNWRAP_NO_ABORT(args.This(), StreamWrap, wrap);
int fd = -1;
if (wrap != NULL && wrap->stream() != NULL) {
fd = wrap->stream()->io_watcher.fd;
Expand All @@ -103,7 +103,7 @@ void StreamWrap::ReadStart(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

StreamWrap* wrap;
UNWRAP(args.This(), StreamWrap, wrap);
NODE_UNWRAP(args.This(), StreamWrap, wrap);

int err;
if (wrap->is_named_pipe_ipc()) {
Expand All @@ -120,7 +120,7 @@ void StreamWrap::ReadStop(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

StreamWrap* wrap;
UNWRAP(args.This(), StreamWrap, wrap);
NODE_UNWRAP(args.This(), StreamWrap, wrap);

int err = uv_read_stop(wrap->stream());
args.GetReturnValue().Set(err);
Expand All @@ -145,7 +145,7 @@ static Local<Object> AcceptHandle(uv_stream_t* pipe) {
return Local<Object>();

WrapType* wrap;
UNWRAP(wrap_obj, WrapType, wrap);
NODE_UNWRAP(wrap_obj, WrapType, wrap);
handle = wrap->UVHandle();

if (uv_accept(pipe, reinterpret_cast<uv_stream_t*>(handle)))
Expand Down Expand Up @@ -205,7 +205,7 @@ void StreamWrap::WriteBuffer(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

StreamWrap* wrap;
UNWRAP(args.This(), StreamWrap, wrap);
NODE_UNWRAP(args.This(), StreamWrap, wrap);

assert(args[0]->IsObject());
assert(Buffer::HasInstance(args[1]));
Expand Down Expand Up @@ -243,7 +243,7 @@ void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
int err;

StreamWrap* wrap;
UNWRAP(args.This(), StreamWrap, wrap);
NODE_UNWRAP(args.This(), StreamWrap, wrap);

assert(args[0]->IsObject());
assert(args[1]->IsString());
Expand Down Expand Up @@ -293,7 +293,7 @@ void StreamWrap::WriteStringImpl(const FunctionCallbackInfo<Value>& args) {
if (args[2]->IsObject()) {
Local<Object> send_handle_obj = args[2].As<Object>();
HandleWrap* wrap;
UNWRAP(send_handle_obj, HandleWrap, wrap);
NODE_UNWRAP(send_handle_obj, HandleWrap, wrap);
send_handle = wrap->GetHandle();

// Reference StreamWrap instance to prevent it from being garbage
Expand Down Expand Up @@ -329,7 +329,7 @@ void StreamWrap::Writev(const FunctionCallbackInfo<Value>& args) {
HandleScope scope;

StreamWrap* wrap;
UNWRAP(args.This(), StreamWrap, wrap);
NODE_UNWRAP(args.This(), StreamWrap, wrap);

assert(args[0]->IsObject());
assert(args[1]->IsArray());
Expand Down Expand Up @@ -474,7 +474,7 @@ void StreamWrap::Shutdown(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

StreamWrap* wrap;
UNWRAP(args.This(), StreamWrap, wrap);
NODE_UNWRAP(args.This(), StreamWrap, wrap);

assert(args[0]->IsObject());
Local<Object> req_wrap_obj = args[0].As<Object>();
Expand Down
26 changes: 13 additions & 13 deletions src/tcp_wrap.cc
Expand Up @@ -130,7 +130,7 @@ void TCPWrap::Initialize(Handle<Object> target) {

TCPWrap* TCPWrap::Unwrap(Local<Object> obj) {
TCPWrap* wrap;
UNWRAP(obj, TCPWrap, wrap);
NODE_UNWRAP(obj, TCPWrap, wrap);
return wrap;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ void TCPWrap::GetSockName(const FunctionCallbackInfo<Value>& args) {
struct sockaddr_storage address;

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

assert(args[0]->IsObject());
Local<Object> out = args[0].As<Object>();
Expand All @@ -193,7 +193,7 @@ void TCPWrap::GetPeerName(const FunctionCallbackInfo<Value>& args) {
struct sockaddr_storage address;

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

assert(args[0]->IsObject());
Local<Object> out = args[0].As<Object>();
Expand All @@ -215,7 +215,7 @@ void TCPWrap::SetNoDelay(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

int enable = static_cast<int>(args[0]->BooleanValue());
int err = uv_tcp_nodelay(&wrap->handle_, enable);
Expand All @@ -227,7 +227,7 @@ void TCPWrap::SetKeepAlive(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

int enable = args[0]->Int32Value();
unsigned int delay = args[1]->Uint32Value();
Expand All @@ -242,7 +242,7 @@ void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

bool enable = args[0]->BooleanValue();
int err = uv_tcp_simultaneous_accepts(&wrap->handle_, enable);
Expand All @@ -254,7 +254,7 @@ void TCPWrap::SetSimultaneousAccepts(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::Open(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);
int fd = args[0]->IntegerValue();
uv_tcp_open(&wrap->handle_, fd);
}
Expand All @@ -264,7 +264,7 @@ void TCPWrap::Bind(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

String::AsciiValue ip_address(args[0]);
int port = args[1]->Int32Value();
Expand All @@ -280,7 +280,7 @@ void TCPWrap::Bind6(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

String::AsciiValue ip6_address(args[0]);
int port = args[1]->Int32Value();
Expand All @@ -296,7 +296,7 @@ void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

int backlog = args[0]->Int32Value();
int err = uv_listen(reinterpret_cast<uv_stream_t*>(&wrap->handle_),
Expand Down Expand Up @@ -327,7 +327,7 @@ void TCPWrap::OnConnection(uv_stream_t* handle, int status) {

// Unwrap the client javascript object.
TCPWrap* wrap;
UNWRAP(client_obj, TCPWrap, wrap);
NODE_UNWRAP(client_obj, TCPWrap, wrap);
uv_stream_t* client_handle = reinterpret_cast<uv_stream_t*>(&wrap->handle_);
if (uv_accept(handle, client_handle))
return;
Expand Down Expand Up @@ -368,7 +368,7 @@ void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

assert(args[0]->IsObject());
assert(args[1]->IsString());
Expand Down Expand Up @@ -400,7 +400,7 @@ void TCPWrap::Connect6(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);

TCPWrap* wrap;
UNWRAP(args.This(), TCPWrap, wrap);
NODE_UNWRAP(args.This(), TCPWrap, wrap);

assert(args[0]->IsObject());
assert(args[1]->IsString());
Expand Down

0 comments on commit 35f789b

Please sign in to comment.