src: reduce number of exported symbols by addaleax · Pull Request #12366 · nodejs/node · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions node.gyp
56 changes: 29 additions & 27 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ using v8::Object;
using v8::String;
using v8::Value;

namespace {

inline const char* ToErrorCodeString(int status) {
switch (status) {
Expand Down Expand Up @@ -114,7 +115,7 @@ GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env,
}


static void NewGetAddrInfoReqWrap(const FunctionCallbackInfo<Value>& args) {
void NewGetAddrInfoReqWrap(const FunctionCallbackInfo<Value>& args) {
CHECK(args.IsConstructCall());
}

Expand All @@ -133,17 +134,17 @@ GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env,
}


static void NewGetNameInfoReqWrap(const FunctionCallbackInfo<Value>& args) {
void NewGetNameInfoReqWrap(const FunctionCallbackInfo<Value>& args) {
CHECK(args.IsConstructCall());
}


static void NewQueryReqWrap(const FunctionCallbackInfo<Value>& args) {
void NewQueryReqWrap(const FunctionCallbackInfo<Value>& args) {
CHECK(args.IsConstructCall());
}


static int cmp_ares_tasks(const node_ares_task* a, const node_ares_task* b) {
int cmp_ares_tasks(const node_ares_task* a, const node_ares_task* b) {
if (a->sock < b->sock)
return -1;
if (a->sock > b->sock)
Expand All @@ -158,14 +159,14 @@ RB_GENERATE_STATIC(node_ares_task_list, node_ares_task, node, cmp_ares_tasks)

/* This is called once per second by loop->timer. It is used to constantly */
/* call back into c-ares for possibly processing timeouts. */
static void ares_timeout(uv_timer_t* handle) {
void ares_timeout(uv_timer_t* handle) {
Environment* env = Environment::from_cares_timer_handle(handle);
CHECK_EQ(false, RB_EMPTY(env->cares_task_list()));
ares_process_fd(env->cares_channel(), ARES_SOCKET_BAD, ARES_SOCKET_BAD);
}


static void ares_poll_cb(uv_poll_t* watcher, int status, int events) {
void ares_poll_cb(uv_poll_t* watcher, int status, int events) {
node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher, watcher);
Environment* env = task->env;

Expand All @@ -186,15 +187,15 @@ static void ares_poll_cb(uv_poll_t* watcher, int status, int events) {
}


static void ares_poll_close_cb(uv_handle_t* watcher) {
void ares_poll_close_cb(uv_handle_t* watcher) {
node_ares_task* task = ContainerOf(&node_ares_task::poll_watcher,
reinterpret_cast<uv_poll_t*>(watcher));
free(task);
}


/* Allocates and returns a new node_ares_task */
static node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) {
node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) {
auto task = node::UncheckedMalloc<node_ares_task>(1);

if (task == nullptr) {
Expand All @@ -216,10 +217,10 @@ static node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) {


/* Callback from ares when socket operation is started */
static void ares_sockstate_cb(void* data,
ares_socket_t sock,
int read,
int write) {
void ares_sockstate_cb(void* data,
ares_socket_t sock,
int read,
int write) {
Environment* env = static_cast<Environment*>(data);
node_ares_task* task;

Expand Down Expand Up @@ -273,7 +274,7 @@ static void ares_sockstate_cb(void* data,
}


static Local<Array> HostentToAddresses(Environment* env, struct hostent* host) {
Local<Array> HostentToAddresses(Environment* env, struct hostent* host) {
EscapableHandleScope scope(env->isolate());
Local<Array> addresses = Array::New(env->isolate());

Expand All @@ -288,7 +289,7 @@ static Local<Array> HostentToAddresses(Environment* env, struct hostent* host) {
}


static Local<Array> HostentToNames(Environment* env, struct hostent* host) {
Local<Array> HostentToNames(Environment* env, struct hostent* host) {
EscapableHandleScope scope(env->isolate());
Local<Array> names = Array::New(env->isolate());

Expand Down Expand Up @@ -1105,7 +1106,7 @@ void AfterGetNameInfo(uv_getnameinfo_t* req,
}


static void IsIP(const FunctionCallbackInfo<Value>& args) {
void IsIP(const FunctionCallbackInfo<Value>& args) {
node::Utf8Value ip(args.GetIsolate(), args[0]);
char address_buffer[sizeof(struct in6_addr)];

Expand All @@ -1118,7 +1119,7 @@ static void IsIP(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(rc);
}

static void IsIPv4(const FunctionCallbackInfo<Value>& args) {
void IsIPv4(const FunctionCallbackInfo<Value>& args) {
node::Utf8Value ip(args.GetIsolate(), args[0]);
char address_buffer[sizeof(struct in_addr)];

Expand All @@ -1129,7 +1130,7 @@ static void IsIPv4(const FunctionCallbackInfo<Value>& args) {
}
}

static void IsIPv6(const FunctionCallbackInfo<Value>& args) {
void IsIPv6(const FunctionCallbackInfo<Value>& args) {
node::Utf8Value ip(args.GetIsolate(), args[0]);
char address_buffer[sizeof(struct in6_addr)];

Expand All @@ -1140,7 +1141,7 @@ static void IsIPv6(const FunctionCallbackInfo<Value>& args) {
}
}

static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

CHECK(args[0]->IsObject());
Expand Down Expand Up @@ -1188,7 +1189,7 @@ static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
}


static void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

CHECK(args[0]->IsObject());
Expand Down Expand Up @@ -1217,7 +1218,7 @@ static void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
}


static void GetServers(const FunctionCallbackInfo<Value>& args) {
void GetServers(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

Local<Array> server_array = Array::New(env->isolate());
Expand Down Expand Up @@ -1246,7 +1247,7 @@ static void GetServers(const FunctionCallbackInfo<Value>& args) {
}


static void SetServers(const FunctionCallbackInfo<Value>& args) {
void SetServers(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);

CHECK(args[0]->IsArray());
Expand Down Expand Up @@ -1313,30 +1314,30 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) {
}


static void StrError(const FunctionCallbackInfo<Value>& args) {
void StrError(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
const char* errmsg = ares_strerror(args[0]->Int32Value());
args.GetReturnValue().Set(OneByteString(env->isolate(), errmsg));
}


static void CaresTimerCloseCb(uv_handle_t* handle) {
void CaresTimerCloseCb(uv_handle_t* handle) {
Environment* env = Environment::from_cares_timer_handle(
reinterpret_cast<uv_timer_t*>(handle));
env->FinishHandleCleanup(handle);
}


static void CaresTimerClose(Environment* env,
void CaresTimerClose(Environment* env,
uv_handle_t* handle,
void* arg) {
uv_close(handle, CaresTimerCloseCb);
}


static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);

int r = ares_library_init(ARES_LIB_INIT_ALL);
Expand Down Expand Up @@ -1424,6 +1425,7 @@ static void Initialize(Local<Object> target,
qrw->GetFunction());
}

} // anonymous namespace
} // namespace cares_wrap
} // namespace node

Expand Down
3 changes: 3 additions & 0 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ using v8::Object;
using v8::String;
using v8::Value;

namespace {

class FSEventWrap: public HandleWrap {
public:
static void Initialize(Local<Object> target,
Expand Down Expand Up @@ -214,6 +216,7 @@ void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleWrap::Close(args);
}

} // anonymous namespace
} // namespace node

NODE_MODULE_CONTEXT_AWARE_BUILTIN(fs_event_wrap, node::FSEventWrap::Initialize)
32 changes: 18 additions & 14 deletions src/node.cc
Loading