Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbdc1fd

Browse filesBrowse files
danbevtargos
authored andcommitted
src, tools: add check for left leaning pointers
This commit adds a rule to cpplint to check that pointers in the code base lean to the left and not right, and also fixes the violations reported. PR-URL: #21010 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent c400448 commit cbdc1fd
Copy full SHA for cbdc1fd
Expand file treeCollapse file tree

23 files changed

+114
-87
lines changed
Open diff view settings
Collapse file

‎src/cares_wrap.cc‎

Copy file name to clipboardExpand all lines: src/cares_wrap.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ class QueryWrap : public AsyncWrap {
633633
wrap->env()->CloseHandle(handle, CaresAsyncClose);
634634
}
635635

636-
static void Callback(void *arg, int status, int timeouts,
636+
static void Callback(void* arg, int status, int timeouts,
637637
unsigned char* answer_buf, int answer_len) {
638638
QueryWrap* wrap = static_cast<QueryWrap*>(arg);
639639

@@ -661,7 +661,7 @@ class QueryWrap : public AsyncWrap {
661661
uv_async_send(async_handle);
662662
}
663663

664-
static void Callback(void *arg, int status, int timeouts,
664+
static void Callback(void* arg, int status, int timeouts,
665665
struct hostent* host) {
666666
QueryWrap* wrap = static_cast<QueryWrap*>(arg);
667667

Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ inline uv_idle_t* Environment::immediate_idle_handle() {
349349

350350
inline void Environment::RegisterHandleCleanup(uv_handle_t* handle,
351351
HandleCleanupCb cb,
352-
void *arg) {
352+
void* arg) {
353353
handle_cleanup_queue_.push_back(HandleCleanup{handle, cb, arg});
354354
}
355355

Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ class Environment {
615615
// Register clean-up cb to be called on environment destruction.
616616
inline void RegisterHandleCleanup(uv_handle_t* handle,
617617
HandleCleanupCb cb,
618-
void *arg);
618+
void* arg);
619619

620620
template <typename T, typename OnCloseCallback>
621621
inline void CloseHandle(T* handle, OnCloseCallback callback);
Collapse file

‎src/exceptions.cc‎

Copy file name to clipboardExpand all lines: src/exceptions.cc
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ using v8::Value;
2222

2323
Local<Value> ErrnoException(Isolate* isolate,
2424
int errorno,
25-
const char *syscall,
26-
const char *msg,
27-
const char *path) {
25+
const char* syscall,
26+
const char* msg,
27+
const char* path) {
2828
Environment* env = Environment::GetCurrent(isolate);
2929

3030
Local<Value> e;
@@ -143,8 +143,8 @@ Local<Value> UVException(Isolate* isolate,
143143
#ifdef _WIN32
144144
// Does about the same as strerror(),
145145
// but supports all windows error messages
146-
static const char *winapi_strerror(const int errorno, bool* must_free) {
147-
char *errmsg = nullptr;
146+
static const char* winapi_strerror(const int errorno, bool* must_free) {
147+
char* errmsg = nullptr;
148148

149149
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
150150
FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, errorno,
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,15 @@ static struct {
315315
}
316316

317317
#if HAVE_INSPECTOR
318-
bool StartInspector(Environment *env, const char* script_path,
318+
bool StartInspector(Environment* env, const char* script_path,
319319
const DebugOptions& options) {
320320
// Inspector agent can't fail to start, but if it was configured to listen
321321
// right away on the websocket port and fails to bind/etc, this will return
322322
// false.
323323
return env->inspector_agent()->Start(platform_, script_path, options);
324324
}
325325

326-
bool InspectorStarted(Environment *env) {
326+
bool InspectorStarted(Environment* env) {
327327
return env->inspector_agent()->IsStarted();
328328
}
329329
#endif // HAVE_INSPECTOR
@@ -352,7 +352,7 @@ static struct {
352352
void Dispose() {}
353353
void DrainVMTasks(Isolate* isolate) {}
354354
void CancelVMTasks(Isolate* isolate) {}
355-
bool StartInspector(Environment *env, const char* script_path,
355+
bool StartInspector(Environment* env, const char* script_path,
356356
const DebugOptions& options) {
357357
env->ThrowError("Node compiled with NODE_USE_V8_PLATFORM=0");
358358
return true;
@@ -374,7 +374,7 @@ static struct {
374374
#endif // !NODE_USE_V8_PLATFORM
375375

376376
#if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
377-
bool InspectorStarted(Environment *env) {
377+
bool InspectorStarted(Environment* env) {
378378
return false;
379379
}
380380
#endif // !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
@@ -419,7 +419,7 @@ static void PrintErrorString(const char* format, ...) {
419419
va_end(ap);
420420
}
421421

422-
const char *signo_string(int signo) {
422+
const char* signo_string(int signo) {
423423
#define SIGNO_CASE(e) case e: return #e;
424424
switch (signo) {
425425
#ifdef SIGHUP
@@ -2452,7 +2452,7 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
24522452
Local<Array> envarr = Array::New(isolate);
24532453
WCHAR* p = environment;
24542454
while (*p) {
2455-
WCHAR *s;
2455+
WCHAR* s;
24562456
if (*p == L'=') {
24572457
// If the key starts with '=' it is a hidden environment variable.
24582458
p += wcslen(p) + 1;
Collapse file

‎src/node.h‎

Copy file name to clipboardExpand all lines: src/node.h
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ NODE_EXTERN extern bool force_fips_crypto;
208208
# endif
209209
#endif
210210

211-
NODE_EXTERN int Start(int argc, char *argv[]);
211+
NODE_EXTERN int Start(int argc, char* argv[]);
212212
NODE_EXTERN void Init(int* argc,
213213
const char** argv,
214214
int* exec_argc,
@@ -455,14 +455,14 @@ NODE_DEPRECATED("Use DecodeWrite(isolate, ...)",
455455
NODE_EXTERN v8::Local<v8::Value> WinapiErrnoException(
456456
v8::Isolate* isolate,
457457
int errorno,
458-
const char *syscall = nullptr,
459-
const char *msg = "",
460-
const char *path = nullptr);
458+
const char* syscall = nullptr,
459+
const char* msg = "",
460+
const char* path = nullptr);
461461

462462
NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)",
463463
inline v8::Local<v8::Value> WinapiErrnoException(int errorno,
464-
const char *syscall = nullptr, const char *msg = "",
465-
const char *path = nullptr) {
464+
const char* syscall = nullptr, const char* msg = "",
465+
const char* path = nullptr) {
466466
return WinapiErrnoException(v8::Isolate::GetCurrent(),
467467
errorno,
468468
syscall,
@@ -471,7 +471,7 @@ NODE_DEPRECATED("Use WinapiErrnoException(isolate, ...)",
471471
})
472472
#endif
473473

474-
const char *signo_string(int errorno);
474+
const char* signo_string(int errorno);
475475

476476

477477
typedef void (*addon_register_func)(
Collapse file

‎src/node_api_types.h‎

Copy file name to clipboardExpand all lines: src/node_api_types.h
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
// JSVM API types are all opaque pointers for ABI stability
1212
// typedef undefined structs instead of void* for compile time type safety
13-
typedef struct napi_env__ *napi_env;
14-
typedef struct napi_value__ *napi_value;
15-
typedef struct napi_ref__ *napi_ref;
16-
typedef struct napi_handle_scope__ *napi_handle_scope;
17-
typedef struct napi_escapable_handle_scope__ *napi_escapable_handle_scope;
18-
typedef struct napi_callback_scope__ *napi_callback_scope;
19-
typedef struct napi_callback_info__ *napi_callback_info;
20-
typedef struct napi_async_context__ *napi_async_context;
21-
typedef struct napi_async_work__ *napi_async_work;
22-
typedef struct napi_deferred__ *napi_deferred;
13+
typedef struct napi_env__* napi_env;
14+
typedef struct napi_value__* napi_value;
15+
typedef struct napi_ref__* napi_ref;
16+
typedef struct napi_handle_scope__* napi_handle_scope;
17+
typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope;
18+
typedef struct napi_callback_scope__* napi_callback_scope;
19+
typedef struct napi_callback_info__* napi_callback_info;
20+
typedef struct napi_async_context__* napi_async_context;
21+
typedef struct napi_async_work__* napi_async_work;
22+
typedef struct napi_deferred__* napi_deferred;
2323

2424
typedef enum {
2525
napi_default = 0,
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3988,8 +3988,8 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) {
39883988

39893989
bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
39903990
dh_.reset(DH_new());
3991-
BIGNUM *bn_p = BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, 0);
3992-
BIGNUM *bn_g = BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, 0);
3991+
BIGNUM* bn_p = BN_bin2bn(reinterpret_cast<const unsigned char*>(p), p_len, 0);
3992+
BIGNUM* bn_g = BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, 0);
39933993
if (!DH_set0_pqg(dh_.get(), bn_p, nullptr, bn_g)) {
39943994
BN_free(bn_p);
39953995
BN_free(bn_g);
Collapse file

‎src/node_crypto.h‎

Copy file name to clipboardExpand all lines: src/node_crypto.h
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,12 @@ class CipherBase : public BaseObject {
368368
const char* iv,
369369
int iv_len,
370370
unsigned int auth_tag_len);
371-
bool InitAuthenticated(const char *cipher_type, int iv_len,
371+
bool InitAuthenticated(const char* cipher_type, int iv_len,
372372
unsigned int auth_tag_len);
373373
bool CheckCCMMessageLength(int message_len);
374374
UpdateResult Update(const char* data, int len, unsigned char** out,
375375
int* out_len);
376-
bool Final(unsigned char** out, int *out_len);
376+
bool Final(unsigned char** out, int* out_len);
377377
bool SetAutoPadding(bool auto_padding);
378378

379379
bool IsAuthenticatedMode() const;
@@ -492,7 +492,7 @@ class Sign : public SignBase {
492492
int key_pem_len,
493493
const char* passphrase,
494494
unsigned char* sig,
495-
unsigned int *sig_len,
495+
unsigned int* sig_len,
496496
int padding,
497497
int saltlen);
498498

@@ -532,10 +532,10 @@ class Verify : public SignBase {
532532

533533
class PublicKeyCipher {
534534
public:
535-
typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX *ctx);
536-
typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX *ctx,
537-
unsigned char *out, size_t *outlen,
538-
const unsigned char *in, size_t inlen);
535+
typedef int (*EVP_PKEY_cipher_init_t)(EVP_PKEY_CTX* ctx);
536+
typedef int (*EVP_PKEY_cipher_t)(EVP_PKEY_CTX* ctx,
537+
unsigned char* out, size_t* outlen,
538+
const unsigned char* in, size_t inlen);
539539

540540
enum Operation {
541541
kPublic,
Collapse file

‎src/node_dtrace.cc‎

Copy file name to clipboardExpand all lines: src/node_dtrace.cc
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void DTRACE_HTTP_SERVER_RESPONSE(const FunctionCallbackInfo<Value>& args) {
194194

195195
void DTRACE_HTTP_CLIENT_REQUEST(const FunctionCallbackInfo<Value>& args) {
196196
node_dtrace_http_client_request_t req;
197-
char *header;
197+
char* header;
198198

199199
if (!NODE_HTTP_CLIENT_REQUEST_ENABLED())
200200
return;
@@ -259,7 +259,7 @@ void InitDTrace(Environment* env, Local<Object> target) {
259259
HandleScope scope(env->isolate());
260260

261261
static struct {
262-
const char *name;
262+
const char* name;
263263
void (*func)(const FunctionCallbackInfo<Value>&);
264264
} tab[] = {
265265
#define NODE_PROBE(name) #name, name

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.