@@ -35,10 +35,8 @@ const char *const syslogPrio[] = {
35
35
#define PRIO_FIELD_NAME " PRIORITY="
36
36
#define PRIO_FIELD_NAME_LEN 9
37
37
38
-
39
- void send ( const Nan::FunctionCallbackInfo<v8::Value>& args ) {
40
-
41
- int argc = args.Length ();
38
+ NAN_METHOD ( send ) {
39
+ int argc = info.Length ();
42
40
struct iovec iov[ argc ];
43
41
44
42
// Make sure nobody forgot the arguments
@@ -47,7 +45,7 @@ void send( const Nan::FunctionCallbackInfo<v8::Value>& args ) {
47
45
return ;
48
46
}
49
47
50
- Nan::MaybeLocal<v8::Integer> priorityArg = Nan::To<v8::Integer>(args [0 ]);
48
+ Nan::MaybeLocal<v8::Integer> priorityArg = Nan::To<v8::Integer>(info [0 ]);
51
49
52
50
// Make sure first argument is a number
53
51
if ( priorityArg.IsEmpty () ) {
@@ -72,7 +70,7 @@ void send( const Nan::FunctionCallbackInfo<v8::Value>& args ) {
72
70
73
71
// Copy all remaining arguments to the iovec
74
72
for ( int i = 1 ; i < argc; i++ ) {
75
- Nan::MaybeLocal<v8::String> strArg = Nan::To<v8::String>(args [i]);
73
+ Nan::MaybeLocal<v8::String> strArg = Nan::To<v8::String>(info [i]);
76
74
// First ensure that the argument is a string
77
75
if ( strArg.IsEmpty () ) {
78
76
Nan::ThrowTypeError ( " Arguments must be strings" );
@@ -95,17 +93,11 @@ void send( const Nan::FunctionCallbackInfo<v8::Value>& args ) {
95
93
}
96
94
97
95
v8::Local<v8::Number> returnValue = Nan::New ( ret );
98
- args.GetReturnValue ().Set ( returnValue );
99
-
96
+ info.GetReturnValue ().Set ( returnValue );
100
97
}
101
98
102
- void init ( v8::Local<v8::Object> exports ) {
103
-
104
- exports->Set (
105
- Nan::New (" send" ).ToLocalChecked (),
106
- Nan::GetFunction (Nan::New<v8::FunctionTemplate>(send)).ToLocalChecked ()
107
- );
108
-
99
+ NAN_MODULE_INIT ( init ) {
100
+ NAN_EXPORT (target, send);
109
101
}
110
102
111
103
NODE_MODULE ( journal_send, init )
0 commit comments