Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgengjiawen <technicalcute@gmail.com>2019-03-06 17:15:22 +0300
committerRefael Ackermann <refack@gmail.com>2019-03-10 05:39:08 +0300
commit6e81a959d0b1d23ecc0ae96ce969da8192ad60f9 (patch)
tree41cd769f03b638d221e11cf8db46a90ae372dd3f /src/node_api.cc
parent78913393fa67fdae7a3a87ccf82093b814edcaf8 (diff)
src: apply clang-tidy various improvement
* rewrite to default label in method ConvertUVErrorCode * improve if condition in method PeekWritable * remove redundant cast in node_file.cc PR-URL: https://github.com/nodejs/node/pull/26470 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_api.cc')
-rw-r--r--src/node_api.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/node_api.cc b/src/node_api.cc
index bfc0c12aad2..fa68323b3c1 100644
--- a/src/node_api.cc
+++ b/src/node_api.cc
@@ -7,6 +7,8 @@
#include "node_errors.h"
#include "node_internals.h"
+#include <memory>
+
struct node_napi_env__ : public napi_env__ {
explicit node_napi_env__(v8::Local<v8::Context> context):
napi_env__(context) {
@@ -220,9 +222,9 @@ class ThreadSafeFunction : public node::AsyncResource {
if (uv_async_init(loop, &async, AsyncCb) == 0) {
if (max_queue_size > 0) {
- cond.reset(new node::ConditionVariable);
+ cond = std::make_unique<node::ConditionVariable>();
}
- if ((max_queue_size == 0 || cond.get() != nullptr) &&
+ if ((max_queue_size == 0 || cond) &&
uv_idle_init(loop, &idle) == 0) {
return napi_ok;
}
@@ -809,15 +811,15 @@ namespace uvimpl {
static napi_status ConvertUVErrorCode(int code) {
switch (code) {
- case 0:
- return napi_ok;
- case UV_EINVAL:
- return napi_invalid_arg;
- case UV_ECANCELED:
- return napi_cancelled;
+ case 0:
+ return napi_ok;
+ case UV_EINVAL:
+ return napi_invalid_arg;
+ case UV_ECANCELED:
+ return napi_cancelled;
+ default:
+ return napi_generic_failure;
}
-
- return napi_generic_failure;
}
// Wrapper around uv_work_t which calls user-provided callbacks.