Skip to content

Commit

Permalink
src: node_dtrace line continuations clean up
Browse files Browse the repository at this point in the history
PR-URL: #15777
Reviewed-By: Lance Ball <[email protected]>
  • Loading branch information
danbev authored and MylesBorins committed Nov 28, 2017
1 parent 0f23836 commit cf80089
Showing 1 changed file with 59 additions and 59 deletions.
118 changes: 59 additions & 59 deletions src/node_dtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,76 +41,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

0 comments on commit cf80089

Please sign in to comment.