@@ -67,6 +67,7 @@ using v8::Object;
67
67
using v8::String;
68
68
using v8::Value;
69
69
70
+ namespace {
70
71
71
72
inline const char * ToErrorCodeString (int status) {
72
73
switch (status) {
@@ -114,7 +115,7 @@ GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env,
114
115
}
115
116
116
117
117
- static void NewGetAddrInfoReqWrap (const FunctionCallbackInfo<Value>& args) {
118
+ void NewGetAddrInfoReqWrap (const FunctionCallbackInfo<Value>& args) {
118
119
CHECK (args.IsConstructCall ());
119
120
}
120
121
@@ -133,17 +134,17 @@ GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env,
133
134
}
134
135
135
136
136
- static void NewGetNameInfoReqWrap (const FunctionCallbackInfo<Value>& args) {
137
+ void NewGetNameInfoReqWrap (const FunctionCallbackInfo<Value>& args) {
137
138
CHECK (args.IsConstructCall ());
138
139
}
139
140
140
141
141
- static void NewQueryReqWrap (const FunctionCallbackInfo<Value>& args) {
142
+ void NewQueryReqWrap (const FunctionCallbackInfo<Value>& args) {
142
143
CHECK (args.IsConstructCall ());
143
144
}
144
145
145
146
146
- static int cmp_ares_tasks (const node_ares_task* a, const node_ares_task* b) {
147
+ int cmp_ares_tasks (const node_ares_task* a, const node_ares_task* b) {
147
148
if (a->sock < b->sock )
148
149
return -1 ;
149
150
if (a->sock > b->sock )
@@ -158,14 +159,14 @@ RB_GENERATE_STATIC(node_ares_task_list, node_ares_task, node, cmp_ares_tasks)
158
159
159
160
/* This is called once per second by loop->timer. It is used to constantly */
160
161
/* call back into c-ares for possibly processing timeouts. */
161
- static void ares_timeout (uv_timer_t * handle) {
162
+ void ares_timeout (uv_timer_t * handle) {
162
163
Environment* env = Environment::from_cares_timer_handle (handle);
163
164
CHECK_EQ (false , RB_EMPTY (env->cares_task_list ()));
164
165
ares_process_fd (env->cares_channel (), ARES_SOCKET_BAD, ARES_SOCKET_BAD);
165
166
}
166
167
167
168
168
- static void ares_poll_cb (uv_poll_t * watcher, int status, int events) {
169
+ void ares_poll_cb (uv_poll_t * watcher, int status, int events) {
169
170
node_ares_task* task = ContainerOf (&node_ares_task::poll_watcher, watcher);
170
171
Environment* env = task->env ;
171
172
@@ -186,15 +187,15 @@ static void ares_poll_cb(uv_poll_t* watcher, int status, int events) {
186
187
}
187
188
188
189
189
- static void ares_poll_close_cb (uv_handle_t * watcher) {
190
+ void ares_poll_close_cb (uv_handle_t * watcher) {
190
191
node_ares_task* task = ContainerOf (&node_ares_task::poll_watcher,
191
192
reinterpret_cast <uv_poll_t *>(watcher));
192
193
free (task);
193
194
}
194
195
195
196
196
197
/* Allocates and returns a new node_ares_task */
197
- static node_ares_task* ares_task_create (Environment* env, ares_socket_t sock) {
198
+ node_ares_task* ares_task_create (Environment* env, ares_socket_t sock) {
198
199
auto task = node::UncheckedMalloc<node_ares_task>(1 );
199
200
200
201
if (task == nullptr ) {
@@ -216,10 +217,10 @@ static node_ares_task* ares_task_create(Environment* env, ares_socket_t sock) {
216
217
217
218
218
219
/* Callback from ares when socket operation is started */
219
- static void ares_sockstate_cb (void * data,
220
- ares_socket_t sock,
221
- int read,
222
- int write) {
220
+ void ares_sockstate_cb (void * data,
221
+ ares_socket_t sock,
222
+ int read,
223
+ int write) {
223
224
Environment* env = static_cast <Environment*>(data);
224
225
node_ares_task* task;
225
226
@@ -273,7 +274,7 @@ static void ares_sockstate_cb(void* data,
273
274
}
274
275
275
276
276
- static Local<Array> HostentToAddresses (Environment* env, struct hostent * host) {
277
+ Local<Array> HostentToAddresses (Environment* env, struct hostent * host) {
277
278
EscapableHandleScope scope (env->isolate ());
278
279
Local<Array> addresses = Array::New (env->isolate ());
279
280
@@ -288,7 +289,7 @@ static Local<Array> HostentToAddresses(Environment* env, struct hostent* host) {
288
289
}
289
290
290
291
291
- static Local<Array> HostentToNames (Environment* env, struct hostent * host) {
292
+ Local<Array> HostentToNames (Environment* env, struct hostent * host) {
292
293
EscapableHandleScope scope (env->isolate ());
293
294
Local<Array> names = Array::New (env->isolate ());
294
295
@@ -1105,7 +1106,7 @@ void AfterGetNameInfo(uv_getnameinfo_t* req,
1105
1106
}
1106
1107
1107
1108
1108
- static void IsIP (const FunctionCallbackInfo<Value>& args) {
1109
+ void IsIP (const FunctionCallbackInfo<Value>& args) {
1109
1110
node::Utf8Value ip (args.GetIsolate (), args[0 ]);
1110
1111
char address_buffer[sizeof (struct in6_addr )];
1111
1112
@@ -1118,7 +1119,7 @@ static void IsIP(const FunctionCallbackInfo<Value>& args) {
1118
1119
args.GetReturnValue ().Set (rc);
1119
1120
}
1120
1121
1121
- static void IsIPv4 (const FunctionCallbackInfo<Value>& args) {
1122
+ void IsIPv4 (const FunctionCallbackInfo<Value>& args) {
1122
1123
node::Utf8Value ip (args.GetIsolate (), args[0 ]);
1123
1124
char address_buffer[sizeof (struct in_addr )];
1124
1125
@@ -1129,7 +1130,7 @@ static void IsIPv4(const FunctionCallbackInfo<Value>& args) {
1129
1130
}
1130
1131
}
1131
1132
1132
- static void IsIPv6 (const FunctionCallbackInfo<Value>& args) {
1133
+ void IsIPv6 (const FunctionCallbackInfo<Value>& args) {
1133
1134
node::Utf8Value ip (args.GetIsolate (), args[0 ]);
1134
1135
char address_buffer[sizeof (struct in6_addr )];
1135
1136
@@ -1140,7 +1141,7 @@ static void IsIPv6(const FunctionCallbackInfo<Value>& args) {
1140
1141
}
1141
1142
}
1142
1143
1143
- static void GetAddrInfo (const FunctionCallbackInfo<Value>& args) {
1144
+ void GetAddrInfo (const FunctionCallbackInfo<Value>& args) {
1144
1145
Environment* env = Environment::GetCurrent (args);
1145
1146
1146
1147
CHECK (args[0 ]->IsObject ());
@@ -1188,7 +1189,7 @@ static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
1188
1189
}
1189
1190
1190
1191
1191
- static void GetNameInfo (const FunctionCallbackInfo<Value>& args) {
1192
+ void GetNameInfo (const FunctionCallbackInfo<Value>& args) {
1192
1193
Environment* env = Environment::GetCurrent (args);
1193
1194
1194
1195
CHECK (args[0 ]->IsObject ());
@@ -1217,7 +1218,7 @@ static void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
1217
1218
}
1218
1219
1219
1220
1220
- static void GetServers (const FunctionCallbackInfo<Value>& args) {
1221
+ void GetServers (const FunctionCallbackInfo<Value>& args) {
1221
1222
Environment* env = Environment::GetCurrent (args);
1222
1223
1223
1224
Local<Array> server_array = Array::New (env->isolate ());
@@ -1246,7 +1247,7 @@ static void GetServers(const FunctionCallbackInfo<Value>& args) {
1246
1247
}
1247
1248
1248
1249
1249
- static void SetServers (const FunctionCallbackInfo<Value>& args) {
1250
+ void SetServers (const FunctionCallbackInfo<Value>& args) {
1250
1251
Environment* env = Environment::GetCurrent (args);
1251
1252
1252
1253
CHECK (args[0 ]->IsArray ());
@@ -1313,30 +1314,30 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) {
1313
1314
}
1314
1315
1315
1316
1316
- static void StrError (const FunctionCallbackInfo<Value>& args) {
1317
+ void StrError (const FunctionCallbackInfo<Value>& args) {
1317
1318
Environment* env = Environment::GetCurrent (args);
1318
1319
const char * errmsg = ares_strerror (args[0 ]->Int32Value ());
1319
1320
args.GetReturnValue ().Set (OneByteString (env->isolate (), errmsg));
1320
1321
}
1321
1322
1322
1323
1323
- static void CaresTimerCloseCb (uv_handle_t * handle) {
1324
+ void CaresTimerCloseCb (uv_handle_t * handle) {
1324
1325
Environment* env = Environment::from_cares_timer_handle (
1325
1326
reinterpret_cast <uv_timer_t *>(handle));
1326
1327
env->FinishHandleCleanup (handle);
1327
1328
}
1328
1329
1329
1330
1330
- static void CaresTimerClose (Environment* env,
1331
+ void CaresTimerClose (Environment* env,
1331
1332
uv_handle_t * handle,
1332
1333
void * arg) {
1333
1334
uv_close (handle, CaresTimerCloseCb);
1334
1335
}
1335
1336
1336
1337
1337
- static void Initialize (Local<Object> target,
1338
- Local<Value> unused,
1339
- Local<Context> context) {
1338
+ void Initialize (Local<Object> target,
1339
+ Local<Value> unused,
1340
+ Local<Context> context) {
1340
1341
Environment* env = Environment::GetCurrent (context);
1341
1342
1342
1343
int r = ares_library_init (ARES_LIB_INIT_ALL);
@@ -1424,6 +1425,7 @@ static void Initialize(Local<Object> target,
1424
1425
qrw->GetFunction ());
1425
1426
}
1426
1427
1428
+ } // anonymous namespace
1427
1429
} // namespace cares_wrap
1428
1430
} // namespace node
1429
1431
0 commit comments