Skip to content

Commit

Permalink
napi: Fix cpplint errors (nodejs#140)
Browse files Browse the repository at this point in the history
Mechanical source transformation
Ran the napi files through clang-format
Fixed up the remaining errors by hand
Also fixed a couple warnings

Generated with following commandline:
clang-format -style="{BasedOnStyle: Google,
                      BinPackArguments: false,
                      BinPackParameters: false,
                      PointerAlignment: Left,
                      AllowAllParametersOfDeclarationOnNextLine: false}"

Reviewed by: @mhdawson
  • Loading branch information
digitalinfinity authored Mar 16, 2017
1 parent 1565f5c commit fc2bc4e
Show file tree
Hide file tree
Showing 20 changed files with 1,079 additions and 950 deletions.
4 changes: 2 additions & 2 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2439,8 +2439,8 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
"\nwas compiled against a different Node.js version using"
"\nNODE_MODULE_VERSION %d. This version of Node.js requires"
"\nNODE_MODULE_VERSION %d. Please try re-compiling or "
"re-installing\nthe module (for instance, using `npm rebuild` or "
"`npm install`).",
"re-installing\nthe module (for instance, using `npm rebuild` "
"or `npm install`).",
*filename, mp->nm_version, NODE_MODULE_VERSION);
}

Expand Down
16 changes: 7 additions & 9 deletions src/node_asyncapi.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#include "node_asyncapi_internal.h"

napi_work napi_create_async_work() {
napi_work_impl* worker = (napi_work_impl*) malloc(sizeof(napi_work_impl));
uv_work_t* req = (uv_work_t*) malloc(sizeof(uv_work_t));
napi_work_impl* worker =
reinterpret_cast<napi_work_impl*>(malloc(sizeof(napi_work_impl)));
uv_work_t* req = reinterpret_cast<uv_work_t*>(malloc(sizeof(uv_work_t)));
req->data = worker;
worker->work = req;
return reinterpret_cast<napi_work>(worker);
Expand All @@ -19,7 +20,6 @@ void napi_delete_async_work(napi_work w) {
}
}


void napi_async_set_data(napi_work w, void* data) {
napi_work_impl* worker = reinterpret_cast<napi_work_impl*>(w);
worker->data = data;
Expand Down Expand Up @@ -53,10 +53,8 @@ void napi_async_complete(uv_work_t* req) {

void napi_async_queue_worker(napi_work w) {
napi_work_impl* worker = reinterpret_cast<napi_work_impl*>(w);
uv_queue_work(
uv_default_loop(),
worker->work,
napi_async_execute,
reinterpret_cast<uv_after_work_cb>(
napi_async_complete));
uv_queue_work(uv_default_loop(),
worker->work,
napi_async_execute,
reinterpret_cast<uv_after_work_cb>(napi_async_complete));
}
24 changes: 12 additions & 12 deletions src/node_asyncapi.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#ifndef SRC_NODE_ASYNCAPI_H_
#define SRC_NODE_ASYNCAPI_H_

#include "node_asyncapi_types.h"
#include <stdlib.h>
#include "node_asyncapi_types.h"

#ifndef NODE_EXTERN
# ifdef _WIN32
# ifndef BUILDING_NODE_EXTENSION
# define NODE_EXTERN __declspec(dllexport)
# else
# define NODE_EXTERN __declspec(dllimport)
# endif
# else
# define NODE_EXTERN /* nothing */
# endif
#ifdef _WIN32
#ifndef BUILDING_NODE_EXTENSION
#define NODE_EXTERN __declspec(dllexport)
#else
#define NODE_EXTERN __declspec(dllimport)
#endif
#else
#define NODE_EXTERN /* nothing */
#endif
#endif

extern "C" {
Expand All @@ -24,6 +24,6 @@ NODE_EXTERN void napi_async_set_execute(napi_work w, void (*execute)(void*));
NODE_EXTERN void napi_async_set_complete(napi_work w, void (*complete)(void*));
NODE_EXTERN void napi_async_set_destroy(napi_work w, void (*destroy)(void*));
NODE_EXTERN void napi_async_queue_worker(napi_work w);
} // extern "C"
} // extern "C"

#endif // SRC_NODE_ASYNCAPI_H_
#endif // SRC_NODE_ASYNCAPI_H_
Loading

0 comments on commit fc2bc4e

Please sign in to comment.