Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve NodeJS v4.x build issue #30

Merged
merged 2 commits into from
Nov 10, 2015
Merged
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
3 changes: 1 addition & 2 deletions lib/tcp.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright 2013 Mark Cavage, Inc. All rights reserved.

var EventEmitter = require('events').EventEmitter;
var net = require('net');
var util = require('util');

Expand Down Expand Up @@ -37,7 +36,7 @@ function createSocket(opts) {
});

PROXY_EVENTS.forEach(function (e) {
s.on(e, EventEmitter.prototype.emit.bind(opts.proxy, e));
s.on(e, opts.proxy.emit.bind(opts.proxy, e));
});

return (s);
Expand Down
6 changes: 3 additions & 3 deletions package.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
},
"dependencies": {
"assert-plus": "0.1.5",
"nan": "1.6.2"
"nan": "2.1.x"
},
"devDependencies": {
"bunyan": "1.3.4",
"bunyan": "1.5.x",
"tap": "0.6.0"
},
"scripts": {
"test": "tap test"
},
"engines": {
"node": ">=0.10"
"node": ">=4.0.0"
}
}
42 changes: 21 additions & 21 deletions src/syslog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
using namespace v8;

#define RETURN_EXCEPTION(MSG) \
NanThrowError(MSG)
Nan::ThrowError(MSG)

#define RETURN_ARGS_EXCEPTION(MSG) \
NanThrowError(MSG)
Nan::ThrowError(MSG)

#define RETURN_ERRNO_EXCEPTION(RC, API, MSG) \
NanThrowError(node::ErrnoException(RC, API, MSG))
Nan::ThrowError(node::ErrnoException(RC, API, MSG))

#define RETURN_OOM_EXCEPTION() \
RETURN_ERRNO_EXCEPTION(ENOMEM, "malloc", strerror(ENOMEM))
Expand Down Expand Up @@ -55,51 +55,51 @@ using namespace v8;
///--- API

NAN_METHOD(Open) {
NanScope();
Nan::HandleScope scope;

REQUIRE_STRING_ARG(args, 0, ident);
REQUIRE_INT_ARG(args, 1, logopt);
REQUIRE_INT_ARG(args, 2, facility);
REQUIRE_STRING_ARG(info, 0, ident);
REQUIRE_INT_ARG(info, 1, logopt);
REQUIRE_INT_ARG(info, 2, facility);

openlog(strdup(*ident), logopt, facility);

NanReturnUndefined();
return;
}

NAN_METHOD(Log) {
NanScope();
Nan::HandleScope scope;

REQUIRE_INT_ARG(args, 0, priority);
REQUIRE_STRING_ARG(args, 1, message);
REQUIRE_INT_ARG(info, 0, priority);
REQUIRE_STRING_ARG(info, 1, message);

syslog(priority, "%s", *message);

NanReturnUndefined();
return;
}

NAN_METHOD(Close) {
NanScope();
Nan::HandleScope scope;

closelog();

NanReturnUndefined();
return;
}

NAN_METHOD(Mask) {
NanEscapableScope();
Nan::EscapableHandleScope scope;

REQUIRE_INT_ARG(args, 0, maskpri);
REQUIRE_INT_ARG(info, 0, maskpri);

int mask = setlogmask(LOG_UPTO(maskpri));

NanReturnValue(NanEscapeScope(NanNew<Integer>(mask)));
info.GetReturnValue().Set(scope.Escape(Nan::New<Integer>(mask)));
}

void init(Handle<Object> target) {
NODE_SET_METHOD(target, "openlog", Open);
NODE_SET_METHOD(target, "syslog", Log);
NODE_SET_METHOD(target, "closelog", Close);
NODE_SET_METHOD(target, "setlogmask", Mask);
Nan::SetMethod(target, "openlog", Open);
Nan::SetMethod(target, "syslog", Log);
Nan::SetMethod(target, "closelog", Close);
Nan::SetMethod(target, "setlogmask", Mask);

NODE_DEFINE_CONSTANT(target, LOG_EMERG);
NODE_DEFINE_CONSTANT(target, LOG_ALERT);
Expand Down