summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cares_wrap.cc4
-rw-r--r--src/env-inl.h2
-rw-r--r--src/env.h2
-rw-r--r--src/exceptions.cc10
-rw-r--r--src/node.cc12
-rw-r--r--src/node.h14
-rw-r--r--src/node_api_types.h20
-rw-r--r--src/node_crypto.cc4
-rw-r--r--src/node_crypto.h14
-rw-r--r--src/node_dtrace.cc4
-rw-r--r--src/node_errors.h4
-rw-r--r--src/node_file.cc2
-rw-r--r--src/node_http2.cc2
-rw-r--r--src/node_http2.h2
-rw-r--r--src/node_internals.h2
-rw-r--r--src/node_main.cc4
-rw-r--r--src/node_platform.cc2
-rw-r--r--src/node_win32_etw_provider-inl.h16
-rw-r--r--src/node_win32_etw_provider.h22
-rw-r--r--src/node_win32_perfctr_provider.cc22
-rw-r--r--src/node_zlib.cc6
-rw-r--r--src/tcp_wrap.cc4
-rw-r--r--tools/cpplint.py27
23 files changed, 114 insertions, 87 deletions
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc
index 24d424f732..cc29ddad55 100644
--- a/src/cares_wrap.cc
+++ b/src/cares_wrap.cc
@@ -633,7 +633,7 @@ class QueryWrap : public AsyncWrap {
wrap->env()->CloseHandle(handle, CaresAsyncClose);
}
- static void Callback(void *arg, int status, int timeouts,
+ static void Callback(void* arg, int status, int timeouts,
unsigned char* answer_buf, int answer_len) {
QueryWrap* wrap = static_cast<QueryWrap*>(arg);
@@ -661,7 +661,7 @@ class QueryWrap : public AsyncWrap {
uv_async_send(async_handle);
}
- static void Callback(void *arg, int status, int timeouts,
+ static void Callback(void* arg, int status, int timeouts,
struct hostent* host) {
QueryWrap* wrap = static_cast<QueryWrap*>(arg);
diff --git a/src/env-inl.h b/src/env-inl.h
index eeb419b4a0..1652448955 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -349,7 +349,7 @@ inline uv_idle_t* Environment::immediate_idle_handle() {
inline void Environment::RegisterHandleCleanup(uv_handle_t* handle,
HandleCleanupCb cb,
- void *arg) {
+ void* arg) {
handle_cleanup_queue_.push_back(HandleCleanup{handle, cb, arg});
}
diff --git a/src/env.h b/src/env.h
index cf6873e5fe..ee734fe920 100644
--- a/src/env.h
+++ b/src/env.h
@@ -615,7 +615,7 @@ class Environment {
// Register clean-up cb to be called on environment destruction.
inline void RegisterHandleCleanup(uv_handle_t* handle,
HandleCleanupCb cb,
- void *arg);
+ void* arg);
template <typename T, typename OnCloseCallback>
inline void CloseHandle(T* handle, OnCloseCallback callback);
diff --git a/src/exceptions.cc b/src/exceptions.cc
index 1bcc7651a2..0007854595 100644
--- a/src/exceptions.cc
+++ b/src/exceptions.cc
@@ -22,9 +22,9 @@ using v8::Value;
Local<Value> ErrnoException(Isolate* isolate,
int errorno,
- const char *syscall,
- const char *msg,
- const char *path) {
+ const char* syscall,
+ const char* msg,
+ const char* path) {
Environment* env = Environment::GetCurrent(isolate);
Local<Value> e;
@@ -143,8 +143,8 @@ Local<Value> UVException(Isolate* isolate,
#ifdef _WIN32
// Does about the same as strerror(),
// but supports all windows error messages
-static const char *winapi_strerror(const int errorno, bool* must_free) {
- char *errmsg = nullptr;
+static const char* winapi_strerror(const int errorno, bool* must_free) {
+ char* errmsg = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, errorno,
diff --git a/src/node.cc b/src/node.cc
index 663e4a222e..2088f505d8 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -320,7 +320,7 @@ static struct {
}
#if HAVE_INSPECTOR
- bool StartInspector(Environment *env, const char* script_path,
+ bool StartInspector(Environment* env, const char* script_path,
const DebugOptions& options) {
// Inspector agent can't fail to start, but if it was configured to listen
// right away on the websocket port and fails to bind/etc, this will return
@@ -328,7 +328,7 @@ static struct {
return env->inspector_agent()->Start(platform_, script_path, options);
}
- bool InspectorStarted(Environment *env) {
+ bool InspectorStarted(Environment* env) {
return env->inspector_agent()->IsStarted();
}
#endif // HAVE_INSPECTOR
@@ -357,7 +357,7 @@ static struct {
void Dispose() {}
void DrainVMTasks(Isolate* isolate) {}
void CancelVMTasks(Isolate* isolate) {}
- bool StartInspector(Environment *env, const char* script_path,
+ bool StartInspector(Environment* env, const char* script_path,
const DebugOptions& options) {
env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0");
return true;
@@ -379,7 +379,7 @@ static struct {
#endif // !NODE_USE_V8_PLATFORM
#if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
- bool InspectorStarted(Environment *env) {
+ bool InspectorStarted(Environment* env) {
return false;
}
#endif // !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
@@ -424,7 +424,7 @@ static void PrintErrorString(const char* format, ...) {
va_end(ap);
}
-const char *signo_string(int signo) {
+const char* signo_string(int signo) {
#define SIGNO_CASE(e) case e: return #e;
switch (signo) {
#ifdef SIGHUP
@@ -2442,7 +2442,7 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
Local<Array> envarr = Array::New(isolate);
WCHAR* p = environment;
while (*p) {
- WCHAR *s;
+ WCHAR* s;
if (*p == L'=') {
// If the key starts with '=' it is a hidden environment variable.
p += wcslen(p) + 1;
diff --git a/src/node.h b/src/node.h
index 44c89afdb7..deaafb009d 100644
--- a/src/node.h
+++ b/src/node.h
@@ -208,7 +208,7 @@ NODE_EXTERN extern bool force_fips_crypto;
# endif
#endif
-NODE_EXTERN int Start(int argc, char *argv[]);
+NODE_EXTERN int Start(int argc, char* argv[]);
NODE_EXTERN void Init(int* argc,
const char** argv,
int* exec_argc,
@@ -455,14 +455,14 @@ NODE_DEPRECATED("Use DecodeWrite(isolate, ...)",
NODE_EXTERN v8::Local<v8::Value> WinapiErrnoException(
v8::Isolate* isolate,
int errorno,
- const char *syscall = nullptr,
- const char *msg = "",
- const char *path = nullptr);
+ const char* syscall = nullptr,
+ const char* msg = "",
+ const char* path = nullptr);
NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)",
inline v8::Local<v8::Value> WinapiErrnoException(int errorno,
- const char *syscall = nullptr, const char *msg = "",
- const char *path = nullptr) {
+ const char* syscall = nullptr, const char* msg = "",
+ const char* path = nullptr) {
return WinapiErrnoException(v8::Isolate::GetCurrent(),
errorno,
syscall,
@@ -471,7 +471,7 @@ NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)",
})
#endif
-const char *signo_string(int errorno);
+const char* signo_string(int errorno);
typedef void (*addon_register_func)(
diff --git a/src/node_api_types.h b/src/node_api_types.h
index 76f38802e8..f7f3ee6275 100644
--- a/src/node_api_types.h
+++ b/src/node_api_types.h
@@ -10,16 +10,16 @@
// JSVM API types are all opaque pointers for ABI stability
// typedef undefined structs instead of void* for compile time type safety
-typedef struct napi_env__ *napi_env;
-typedef struct napi_value__ *napi_value;
-typedef struct napi_ref__ *napi_ref;
-typedef struct napi_handle_scope__ *napi_handle_scope;
-typedef struct napi_escapable_handle_scope__ *napi_escapable_handle_scope;
-typedef struct napi_callback_scope__ *napi_callback_scope;
-typedef struct napi_callback_info__ *napi_callback_info;
-typedef struct napi_async_context__ *napi_async_context;
-typedef struct napi_async_work__ *napi_async_work;
-typedef struct napi_deferred__ *napi_deferred;
+typedef struct napi_env__* napi_env;
+typedef struct napi_value__* napi_value;
+typedef struct napi_ref__* napi_ref;
+typedef struct napi_handle_scope__* napi_handle_scope;
+typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope;
+typedef struct napi_callback_scope__* napi_callback_scope;
+typedef struct napi_callback_info__* napi_callback_info;
+typedef struct napi_async_context__* napi_async_context;
+typedef struct napi_async_work__* napi_async_work;
+typedef struct napi_deferred__* napi_deferred;
typedef enum {
napi_default = 0,
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index d81853331b..d5d1b031c5 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -3985,8 +3985,8 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
dh_.reset(DH_new());
- BIGNUM *bn_p = BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, 0);
- BIGNUM *bn_g = BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, 0);
+ BIGNUM* bn_p = BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, 0);
+ BIGNUM* bn_g = BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, 0);
if (!DH_set0_pqg(dh_.get(), bn_p, nullptr, bn_g)) {
BN_free(bn_p);
BN_free(bn_g);
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 0bc808aa17..8d40f85099 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -368,12 +368,12 @@ class CipherBase : public BaseObject {
const char* iv,
int iv_len,
unsigned int auth_tag_len);
- bool InitAuthenticated(const char *cipher_type, int iv_len,
+ bool InitAuthenticated(const char* cipher_type, int iv_len,
unsigned int auth_tag_len);
bool CheckCCMMessageLength(int message_len);
UpdateResult Update(const char* data, int len, unsigned char** out,
int* out_len);
- bool Final(unsigned char** out, int *out_len);
+ bool Final(unsigned char** out, int* out_len);
bool SetAutoPadding(bool auto_padding);
bool IsAuthenticatedMode() const;
@@ -492,7 +492,7 @@ class Sign : public SignBase {
int key_pem_len,
const char* passphrase,
unsigned char* sig,
- unsigned int *sig_len,
+ unsigned int* sig_len,
int padding,
int saltlen);
@@ -532,10 +532,10 @@ class Verify : public SignBase {
class PublicKeyCipher {
public:
- typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX *ctx);
- typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX *ctx,
- unsigned char *out, size_t *outlen,
- const unsigned char *in, size_t inlen);
+ typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX* ctx);
+ typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX* ctx,
+ unsigned char* out, size_t* outlen,
+ const unsigned char* in, size_t inlen);
enum Operation {
kPublic,
diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc
index 29e6276824..66e24afcac 100644
--- a/src/node_dtrace.cc
+++ b/src/node_dtrace.cc
@@ -194,7 +194,7 @@ void DTRACE_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo<Value>& args) {
void DTRACE_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo<Value>& args) {
node_dtrace_http_client_request_t req;
- char *header;
+ char* header;
if (!NODE_HTTP_CLIENT_REQUEST_ENABLED())
return;
@@ -259,7 +259,7 @@ void InitDTrace(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate());
static struct {
- const char *name;
+ const char* name;
void (*func)(const FunctionCallbackInfo<Value>&);
} tab[] = {
#define NODE_PROBE(name) #name, name
diff --git a/src/node_errors.h b/src/node_errors.h
index 2c97088cc5..f767b414fa 100644
--- a/src/node_errors.h
+++ b/src/node_errors.h
@@ -96,7 +96,7 @@ inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str());
}
-inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate *isolate) {
+inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a Buffer larger than 0x%lx bytes",
@@ -104,7 +104,7 @@ inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate *isolate) {
return ERR_BUFFER_TOO_LARGE(isolate, message);
}
-inline v8::Local<v8::Value> ERR_STRING_TOO_LONG(v8::Isolate *isolate) {
+inline v8::Local<v8::Value> ERR_STRING_TOO_LONG(v8::Isolate* isolate) {
char message[128];
snprintf(message, sizeof(message),
"Cannot create a string longer than 0x%x characters",
diff --git a/src/node_file.cc b/src/node_file.cc
index 789269d712..d4f3cbfcfb 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -659,7 +659,7 @@ inline int SyncCall(Environment* env, Local<Value> ctx, FSReqWrapSync* req_wrap,
if (err < 0) {
Local<Context> context = env->context();
Local<Object> ctx_obj = ctx.As<Object>();
- Isolate *isolate = env->isolate();
+ Isolate* isolate = env->isolate();
ctx_obj->Set(context,
env->errno_string(),
Integer::New(isolate, err)).FromJust();
diff --git a/src/node_http2.cc b/src/node_http2.cc
index be43cc1e69..5629298eb9 100644
--- a/src/node_http2.cc
+++ b/src/node_http2.cc
@@ -840,7 +840,7 @@ int Http2Session::OnFrameReceive(nghttp2_session* handle,
}
int Http2Session::OnInvalidFrame(nghttp2_session* handle,
- const nghttp2_frame *frame,
+ const nghttp2_frame* frame,
int lib_error_code,
void* user_data) {
Http2Session* session = static_cast<Http2Session*>(user_data);
diff --git a/src/node_http2.h b/src/node_http2.h
index e0a93c8f0f..eb06d740ba 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -965,7 +965,7 @@ class Http2Session : public AsyncWrap, public StreamListener {
void* user_data);
static int OnInvalidFrame(
nghttp2_session* session,
- const nghttp2_frame *frame,
+ const nghttp2_frame* frame,
int lib_error_code,
void* user_data);
diff --git a/src/node_internals.h b/src/node_internals.h
index 7760eb26c6..f76aacd7e8 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -549,7 +549,7 @@ int ThreadPoolWork::CancelWork() {
return uv_cancel(reinterpret_cast<uv_req_t*>(&work_req_));
}
-static inline const char *errno_string(int errorno) {
+static inline const char* errno_string(int errorno) {
#define ERRNO_CASE(e) case e: return #e;
switch (errorno) {
#ifdef EACCES
diff --git a/src/node_main.cc b/src/node_main.cc
index 8907c47ae0..bea1af7bdd 100644
--- a/src/node_main.cc
+++ b/src/node_main.cc
@@ -27,7 +27,7 @@
#include <VersionHelpers.h>
#include <WinError.h>
-int wmain(int argc, wchar_t *wargv[]) {
+int wmain(int argc, wchar_t* wargv[]) {
if (!IsWindows7OrGreater()) {
fprintf(stderr, "This application is only supported on Windows 7, "
"Windows Server 2008 R2, or higher.");
@@ -91,7 +91,7 @@ namespace node {
extern bool linux_at_secure;
} // namespace node
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
#if defined(__POSIX__) && defined(NODE_SHARED_MODE)
// In node::PlatformInit(), we squash all signal handlers for non-shared lib
// build. In order to run test cases against shared lib build, we also need
diff --git a/src/node_platform.cc b/src/node_platform.cc
index f2407f5be2..a8258ed74b 100644
--- a/src/node_platform.cc
+++ b/src/node_platform.cc
@@ -16,7 +16,7 @@ using v8::Platform;
using v8::Task;
using v8::TracingController;
-static void BackgroundRunner(void *data) {
+static void BackgroundRunner(void* data) {
TRACE_EVENT_METADATA1("__metadata", "thread_name", "name",
"BackgroundTaskRunner");
TaskQueue<Task> *background_tasks = static_cast<TaskQueue<Task> *>(data);
diff --git a/src/node_win32_etw_provider-inl.h b/src/node_win32_etw_provider-inl.h
index 98a28f14f4..a7846f413a 100644
--- a/src/node_win32_etw_provider-inl.h
+++ b/src/node_win32_etw_provider-inl.h
@@ -120,8 +120,8 @@ extern int events_enabled;
void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req,
- node_dtrace_connection_t* conn, const char *remote, int port,
- const char *method, const char *url, int fd) {
+ node_dtrace_connection_t* conn, const char* remote, int port,
+ const char* method, const char* url, int fd) {
EVENT_DATA_DESCRIPTOR descriptors[7];
ETW_WRITE_HTTP_SERVER_REQUEST(descriptors, req);
ETW_WRITE_NET_CONNECTION(descriptors + 3, conn);
@@ -130,7 +130,7 @@ void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req,
void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd) {
+ const char* remote, int port, int fd) {
EVENT_DATA_DESCRIPTOR descriptors[4];
ETW_WRITE_NET_CONNECTION(descriptors, conn);
ETW_WRITE_EVENT(NODE_HTTP_SERVER_RESPONSE_EVENT, descriptors);
@@ -138,8 +138,8 @@ void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn,
void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req,
- node_dtrace_connection_t* conn, const char *remote, int port,
- const char *method, const char *url, int fd) {
+ node_dtrace_connection_t* conn, const char* remote, int port,
+ const char* method, const char* url, int fd) {
EVENT_DATA_DESCRIPTOR descriptors[6];
ETW_WRITE_HTTP_CLIENT_REQUEST(descriptors, req);
ETW_WRITE_NET_CONNECTION(descriptors + 2, conn);
@@ -148,7 +148,7 @@ void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req,
void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd) {
+ const char* remote, int port, int fd) {
EVENT_DATA_DESCRIPTOR descriptors[4];
ETW_WRITE_NET_CONNECTION(descriptors, conn);
ETW_WRITE_EVENT(NODE_HTTP_CLIENT_RESPONSE_EVENT, descriptors);
@@ -156,7 +156,7 @@ void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn,
void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd) {
+ const char* remote, int port, int fd) {
EVENT_DATA_DESCRIPTOR descriptors[4];
ETW_WRITE_NET_CONNECTION(descriptors, conn);
ETW_WRITE_EVENT(NODE_NET_SERVER_CONNECTION_EVENT, descriptors);
@@ -164,7 +164,7 @@ void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn,
void NODE_NET_STREAM_END(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd) {
+ const char* remote, int port, int fd) {
EVENT_DATA_DESCRIPTOR descriptors[4];
ETW_WRITE_NET_CONNECTION(descriptors, conn);
ETW_WRITE_EVENT(NODE_NET_STREAM_END_EVENT, descriptors);
diff --git a/src/node_win32_etw_provider.h b/src/node_win32_etw_provider.h
index 53b9529b53..0f84a86f0a 100644
--- a/src/node_win32_etw_provider.h
+++ b/src/node_win32_etw_provider.h
@@ -35,18 +35,18 @@ namespace node {
# define INLINE inline
#endif
-typedef ULONG (NTAPI *EventRegisterFunc)(
+typedef ULONG (NTAPI* EventRegisterFunc)(
LPCGUID ProviderId,
PENABLECALLBACK EnableCallback,
PVOID CallbackContext,
PREGHANDLE RegHandle
);
-typedef ULONG (NTAPI *EventUnregisterFunc)(
+typedef ULONG (NTAPI* EventUnregisterFunc)(
REGHANDLE RegHandle
);
-typedef ULONG (NTAPI *EventWriteFunc)(
+typedef ULONG (NTAPI* EventWriteFunc)(
REGHANDLE RegHandle,
PCEVENT_DESCRIPTOR EventDescriptor,
ULONG UserDataCount,
@@ -57,19 +57,19 @@ void init_etw();
void shutdown_etw();
INLINE void NODE_HTTP_SERVER_REQUEST(node_dtrace_http_server_request_t* req,
- node_dtrace_connection_t* conn, const char *remote, int port,
- const char *method, const char *url, int fd);
+ node_dtrace_connection_t* conn, const char* remote, int port,
+ const char* method, const char* url, int fd);
INLINE void NODE_HTTP_SERVER_RESPONSE(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd);
+ const char* remote, int port, int fd);
INLINE void NODE_HTTP_CLIENT_REQUEST(node_dtrace_http_client_request_t* req,
- node_dtrace_connection_t* conn, const char *remote, int port,
- const char *method, const char *url, int fd);
+ node_dtrace_connection_t* conn, const char* remote, int port,
+ const char* method, const char* url, int fd);
INLINE void NODE_HTTP_CLIENT_RESPONSE(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd);
+ const char* remote, int port, int fd);
INLINE void NODE_NET_SERVER_CONNECTION(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd);
+ const char* remote, int port, int fd);
INLINE void NODE_NET_STREAM_END(node_dtrace_connection_t* conn,
- const char *remote, int port, int fd);
+ const char* remote, int port, int fd);
INLINE void NODE_GC_START(v8::GCType type,
v8::GCCallbackFlags flags,
v8::Isolate* isolate);
diff --git a/src/node_win32_perfctr_provider.cc b/src/node_win32_perfctr_provider.cc
index 6ec3cbd5cf..7e94db9fed 100644
--- a/src/node_win32_perfctr_provider.cc
+++ b/src/node_win32_perfctr_provider.cc
@@ -28,60 +28,60 @@
#include "node_perfctr_provider.h"
-typedef ULONG (WINAPI *PerfStartProviderExFunc)(
+typedef ULONG (WINAPI* PerfStartProviderExFunc)(
__in LPGUID ProviderGuid,
__in_opt PPERF_PROVIDER_CONTEXT ProviderContext,
__out PHANDLE Provider);
-typedef ULONG (WINAPI *PerfStopProviderFunc)(
+typedef ULONG (WINAPI* PerfStopProviderFunc)(
__in HANDLE ProviderHandle);
-typedef ULONG (WINAPI *PerfSetCounterSetInfoFunc)(
+typedef ULONG (WINAPI* PerfSetCounterSetInfoFunc)(
__in HANDLE ProviderHandle,
__inout_bcount(TemplateSize) PPERF_COUNTERSET_INFO Template,
__in ULONG TemplateSize);
-typedef PPERF_COUNTERSET_INSTANCE (WINAPI *PerfCreateInstanceFunc)(
+typedef PPERF_COUNTERSET_INSTANCE (WINAPI* PerfCreateInstanceFunc)(
__in HANDLE ProviderHandle,
__in LPCGUID CounterSetGuid,
__in PCWSTR Name,
__in ULONG Id);
-typedef ULONG (WINAPI *PerfDeleteInstanceFunc)(
+typedef ULONG (WINAPI* PerfDeleteInstanceFunc)(
__in HANDLE Provider,
__in PPERF_COUNTERSET_INSTANCE InstanceBlock);
-typedef ULONG (WINAPI *PerfSetULongCounterValueFunc)(
+typedef ULONG (WINAPI* PerfSetULongCounterValueFunc)(
__in HANDLE Provider,
__inout PPERF_COUNTERSET_INSTANCE Instance,
__in ULONG CounterId,
__in ULONG Value);
-typedef ULONG (WINAPI *PerfSetULongLongCounterValueFunc)(
+typedef ULONG (WINAPI* PerfSetULongLongCounterValueFunc)(
__in HANDLE Provider,
__inout PPERF_COUNTERSET_INSTANCE Instance,
__in ULONG CounterId,
__in ULONGLONG Value);
-typedef ULONG (WINAPI *PerfIncrementULongCounterValueFunc)(
+typedef ULONG (WINAPI* PerfIncrementULongCounterValueFunc)(
__in HANDLE Provider,
__inout PPERF_COUNTERSET_INSTANCE Instance,
__in ULONG CounterId,
__in ULONG Value);
-typedef ULONG (WINAPI *PerfIncrementULongLongCounterValueFunc)(
+typedef ULONG (WINAPI* PerfIncrementULongLongCounterValueFunc)(
__in HANDLE Provider,
__inout PPERF_COUNTERSET_INSTANCE Instance,
__in ULONG CounterId,
__in ULONGLONG Value);
-typedef ULONG (WINAPI *PerfDecrementULongCounterValueFunc)(
+typedef ULONG (WINAPI* PerfDecrementULongCounterValueFunc)(
__in HANDLE Provider,
__inout PPERF_COUNTERSET_INSTANCE Instance,
__in ULONG CounterId,
__in ULONG Value);
-typedef ULONG (WINAPI *PerfDecrementULongLongCounterValueFunc)(
+typedef ULONG (WINAPI* PerfDecrementULongLongCounterValueFunc)(
__in HANDLE Provider,
__inout PPERF_COUNTERSET_INSTANCE Instance,
__in ULONG CounterId,
diff --git a/src/node_zlib.cc b/src/node_zlib.cc
index 87415eb575..de8b033589 100644
--- a/src/node_zlib.cc
+++ b/src/node_zlib.cc
@@ -164,8 +164,8 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork {
CHECK(0 && "Invalid flush value");
}
- Bytef *in;
- Bytef *out;
+ Bytef* in;
+ Bytef* out;
size_t in_off, in_len, out_off, out_len;
Environment* env = ctx->env();
@@ -500,7 +500,7 @@ class ZCtx : public AsyncWrap, public ThreadPoolWork {
SetDictionary(ctx);
}
- static bool Init(ZCtx *ctx, int level, int windowBits, int memLevel,
+ static bool Init(ZCtx* ctx, int level, int windowBits, int memLevel,
int strategy, uint32_t* write_result,
Local<Function> write_js_callback, char* dictionary,
size_t dictionary_len) {
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index 8200353b17..01c7d253e6 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -341,8 +341,8 @@ Local<Object> AddressToJS(Environment* env,
Local<Object> info) {
EscapableHandleScope scope(env->isolate());
char ip[INET6_ADDRSTRLEN];
- const sockaddr_in *a4;
- const sockaddr_in6 *a6;
+ const sockaddr_in* a4;
+ const sockaddr_in6* a6;
int port;
if (info.IsEmpty())
diff --git a/tools/cpplint.py b/tools/cpplint.py
index ee103ef716..a4f786f01a 100644
--- a/tools/cpplint.py
+++ b/tools/cpplint.py
@@ -527,6 +527,10 @@ _SEARCH_KERNEL_FILE = re.compile(r'\b(?:LINT_KERNEL_FILE)')
_NULL_TOKEN_PATTERN = re.compile(r'\bNULL\b')
+_RIGHT_LEANING_POINTER_PATTERN = re.compile(r'[^=|(,\s><);&?:}]'
+ r'(?<!(sizeof|return))'
+ r'\s\*[a-zA-z_][0-9a-zA-z_]*')
+
_regexp_compile_cache = {}
# {str, set(int)}: a map from error categories to sets of linenumbers
@@ -4179,6 +4183,28 @@ def CheckNullTokens(filename, clean_lines, linenum, error):
error(filename, linenum, 'readability/null_usage', 2,
'Use nullptr instead of NULL')
+def CheckLeftLeaningPointer(filename, clean_lines, linenum, error):
+ """Check for left-leaning pointer placement.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Avoid preprocessor lines
+ if Match(r'^\s*#', line):
+ return
+
+ if '/*' in line or '*/' in line:
+ return
+
+ for match in _RIGHT_LEANING_POINTER_PATTERN.finditer(line):
+ error(filename, linenum, 'readability/null_usage', 2,
+ 'Use left leaning pointer instead of right leaning')
+
def GetLineWidth(line):
"""Determines the width of the line in column positions.
@@ -4321,6 +4347,7 @@ def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
CheckCheck(filename, clean_lines, linenum, error)
CheckAltTokens(filename, clean_lines, linenum, error)
CheckNullTokens(filename, clean_lines, linenum, error)
+ CheckLeftLeaningPointer(filename, clean_lines, linenum, error)
classinfo = nesting_state.InnermostClass()
if classinfo:
CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)