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

src: node_dtrace line continuations clean up #15777

Closed
wants to merge 1 commit into from
Closed
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
118 changes: 59 additions & 59 deletions src/node_dtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,76 +59,76 @@ using v8::Object;
using v8::String;
using v8::Value;

#define SLURP_STRING(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
#define SLURP_STRING(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
"expected object for " #obj " to contain string member " #member); \
} \
node::Utf8Value _##member(env->isolate(), \
obj->Get(OneByteString(env->isolate(), #member))); \
if ((*(const char **)valp = *_##member) == nullptr) \
} \
node::Utf8Value _##member(env->isolate(), \
obj->Get(OneByteString(env->isolate(), #member))); \
if ((*(const char **)valp = *_##member) == nullptr) \
*(const char **)valp = "<unknown>";

#define SLURP_INT(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
"expected object for " #obj " to contain integer member " #member); \
} \
*valp = obj->Get(OneByteString(env->isolate(), #member)) \
#define SLURP_INT(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
"expected object for " #obj " to contain integer member " #member); \
} \
*valp = obj->Get(OneByteString(env->isolate(), #member)) \
->Int32Value();

#define SLURP_OBJECT(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
"expected object for " #obj " to contain object member " #member); \
} \
#define SLURP_OBJECT(obj, member, valp) \
if (!(obj)->IsObject()) { \
return env->ThrowError( \
"expected object for " #obj " to contain object member " #member); \
} \
*valp = Local<Object>::Cast(obj->Get(OneByteString(env->isolate(), #member)));

#define SLURP_CONNECTION(arg, conn) \
if (!(arg)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg); \
Local<Value> _handle = \
(_##conn)->Get(FIXED_ONE_BYTE_STRING(env->isolate(), "_handle")); \
if (_handle->IsObject()) { \
SLURP_INT(_handle.As<Object>(), fd, &conn.fd); \
} else { \
conn.fd = -1; \
} \
SLURP_STRING(_##conn, remoteAddress, &conn.remote); \
SLURP_INT(_##conn, remotePort, &conn.port); \
#define SLURP_CONNECTION(arg, conn) \
if (!(arg)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg); \
Local<Value> _handle = \
(_##conn)->Get(FIXED_ONE_BYTE_STRING(env->isolate(), "_handle")); \
if (_handle->IsObject()) { \
SLURP_INT(_handle.As<Object>(), fd, &conn.fd); \
} else { \
conn.fd = -1; \
} \
SLURP_STRING(_##conn, remoteAddress, &conn.remote); \
SLURP_INT(_##conn, remotePort, &conn.port); \
SLURP_INT(_##conn, bufferSize, &conn.buffered);

#define SLURP_CONNECTION_HTTP_CLIENT(arg, conn) \
if (!(arg)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg); \
SLURP_INT(_##conn, fd, &conn.fd); \
SLURP_STRING(_##conn, host, &conn.remote); \
SLURP_INT(_##conn, port, &conn.port); \
#define SLURP_CONNECTION_HTTP_CLIENT(arg, conn) \
if (!(arg)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg); \
SLURP_INT(_##conn, fd, &conn.fd); \
SLURP_STRING(_##conn, host, &conn.remote); \
SLURP_INT(_##conn, port, &conn.port); \
SLURP_INT(_##conn, bufferSize, &conn.buffered);

#define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(arg0, arg1, conn) \
if (!(arg0)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg0 " to be a connection object"); \
} \
if (!(arg1)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg1 " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg0); \
SLURP_INT(_##conn, fd, &conn.fd); \
SLURP_INT(_##conn, bufferSize, &conn.buffered); \
_##conn = Local<Object>::Cast(arg1); \
SLURP_STRING(_##conn, host, &conn.remote); \
#define SLURP_CONNECTION_HTTP_CLIENT_RESPONSE(arg0, arg1, conn) \
if (!(arg0)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg0 " to be a connection object"); \
} \
if (!(arg1)->IsObject()) { \
return env->ThrowError( \
"expected argument " #arg1 " to be a connection object"); \
} \
node_dtrace_connection_t conn; \
Local<Object> _##conn = Local<Object>::Cast(arg0); \
SLURP_INT(_##conn, fd, &conn.fd); \
SLURP_INT(_##conn, bufferSize, &conn.buffered); \
_##conn = Local<Object>::Cast(arg1); \
SLURP_STRING(_##conn, host, &conn.remote); \
SLURP_INT(_##conn, port, &conn.port);


Expand Down