Skip to content

Commit a23c2d9

Browse files
committed
Fix some errors
1 parent 7db7fa4 commit a23c2d9

File tree

6 files changed

+14
-24
lines changed

6 files changed

+14
-24
lines changed

src/rcl_bindings.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include "rcl_bindings.h"
1616

17-
#include <napi.h>
1817
#include <node.h>
1918
#include <rcl/arguments.h>
2019
#include <rcl/error_handling.h>
@@ -59,8 +58,7 @@
5958

6059
namespace rclnodejs {
6160

62-
static Napi::Object wrapParameters(
63-
Napi::Env env, rcl_params_t* params); // NOLINT(whitespace/line_length)
61+
static Napi::Object wrapParameters(Napi::Env env, rcl_params_t* params);
6462

6563
Napi::Value InitRclnodejs(const Napi::CallbackInfo& info) {
6664
Napi::Env env = info.Env();
@@ -71,12 +69,12 @@ Napi::Value InitRclnodejs(const Napi::CallbackInfo& info) {
7169
rcl_init_options_init(&init_options, allocator),
7270
rcl_get_error_string().str);
7371

74-
// preprocess Context
72+
// Preprocess Context
7573
RclHandle* context_handle = RclHandle::Unwrap(info[0].As<Napi::Object>());
7674
rcl_context_t* context =
7775
reinterpret_cast<rcl_context_t*>(context_handle->ptr());
7876

79-
// preprocess argc & argv
77+
// Preprocess argc & argv
8078
Napi::Array jsArgv = info[1].As<Napi::Array>();
8179
int argc = jsArgv.Length();
8280
char** argv = nullptr;
@@ -1740,7 +1738,7 @@ Napi::Value GetClientNamesAndTypesByNode(const Napi::CallbackInfo& info) {
17401738
rcl_get_zero_initialized_names_and_types();
17411739
rcl_allocator_t allocator = rcl_get_default_allocator();
17421740
THROW_ERROR_IF_NOT_EQUAL(RCL_RET_OK,
1743-
rcl_get_service_names_and_types_by_node(
1741+
rcl_get_client_names_and_types_by_node(
17441742
node, &allocator, node_name.c_str(),
17451743
node_namespace.c_str(), &client_names_and_types),
17461744
"Failed to get_client_names_and_types.");

src/rcl_bindings.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@
2525

2626
namespace rclnodejs {
2727

28-
typedef Napi::Value (*JsCFunction)(const Napi::CallbackInfo& info);
29-
30-
typedef struct {
31-
const char* name;
32-
JsCFunction function;
33-
} BindingMethod;
34-
35-
extern rcl_guard_condition_t* g_sigint_gc;
36-
3728
void ExtractNamesAndTypes(rcl_names_and_types_t names_and_types,
3829
Napi::Array* result_list);
3930

src/rcl_handle.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <rcl/error_handling.h>
1818
#include <rcl/rcl.h>
1919

20-
#include <iostream>
21-
2220
#include "rcl_utilities.h"
2321

2422
namespace rclnodejs {

src/rcl_lifecycle_bindings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017 Intel Corporation. All rights reserved.
1+
// Copyright (c) 2020 Wayne Parrott. All rights reserved.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

src/rcl_utilities.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
#include <string>
2222

2323
namespace {
24+
2425
uv_lib_t g_lib;
26+
Napi::Env g_env = nullptr;
27+
2528
} // namespace
2629

2730
namespace rclnodejs {
@@ -95,4 +98,8 @@ std::string GetErrorMessageAndClear() {
9598
return std::string(uv_dlerror(&g_lib));
9699
}
97100

101+
Napi::Env& GetEnv() { return g_env; }
102+
103+
void StoreEnv(Napi::Env current_env) { g_env = current_env; }
104+
98105
} // namespace rclnodejs

src/rcl_utilities.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,8 @@ const rosidl_action_type_support_t* GetActionTypeSupport(
3838
std::string GetErrorMessageAndClear();
3939

4040
// Store a reference to the environment that can be used for error reporting.
41-
inline Napi::Env& GetEnv() {
42-
static thread_local Napi::Env env = nullptr;
43-
return env;
44-
}
45-
46-
inline void StoreEnv(Napi::Env current_env) { GetEnv() = current_env; }
41+
Napi::Env& GetEnv();
42+
void StoreEnv(Napi::Env current_env);
4743

4844
} // namespace rclnodejs
4945

0 commit comments

Comments
 (0)