From 4982ae2d4e0e0d49395b1e7722a11cd00cd1c967 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Wed, 4 Dec 2024 13:01:39 +0100 Subject: [PATCH] Fix build and linters Signed-off-by: Alejandro Hernandez Cordero --- rmw_zenoh_cpp/src/detail/graph_cache.cpp | 1 + .../src/detail/rmw_context_impl_s.cpp | 60 +++++++++---------- rmw_zenoh_cpp/src/rmw_init.cpp | 1 - 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.cpp b/rmw_zenoh_cpp/src/detail/graph_cache.cpp index 1e3e5517..c602699e 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.cpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.cpp @@ -13,6 +13,7 @@ // limitations under the License. #include +#include #include #include #include diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index 7915cd9e..29dddb2e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -78,12 +78,12 @@ class rmw_context_impl_s::Data final } // Check if shm is enabled. - z_owned_string_t shm_enabled; - zc_config_get_from_str(z_loan(config), Z_CONFIG_SHARED_MEMORY_KEY, &shm_enabled); - auto always_free_shm_enabled = rcpputils::make_scope_exit( - [&shm_enabled]() { - z_drop(z_move(shm_enabled)); - }); + // z_owned_string_t shm_enabled; + // zc_config_get_from_str(z_loan(config), Z_CONFIG_SHARED_MEMORY_KEY, &shm_enabled); + // auto always_free_shm_enabled = rcpputils::make_scope_exit( + // [&shm_enabled]() { + // z_drop(z_move(shm_enabled)); + // }); // Initialize the zenoh session. if (z_open(&session_, z_move(config), NULL) != Z_OK) { @@ -166,29 +166,29 @@ class rmw_context_impl_s::Data final // Initialize the shm manager if shared_memory is enabled in the config. shm_provider_ = std::nullopt; - if (strncmp( - z_string_data(z_loan(shm_enabled)), - "true", - z_string_len(z_loan(shm_enabled))) == 0) - { - // TODO(yuyuan): determine the default alignment of SHM - z_alloc_alignment_t alignment = {5}; - z_owned_memory_layout_t layout; - z_memory_layout_new(&layout, SHM_BUFFER_SIZE_MB * 1024 * 1024, alignment); - - z_owned_shm_provider_t provider; - if (z_posix_shm_provider_new(&provider, z_loan(layout)) != Z_OK) { - RMW_ZENOH_LOG_ERROR_NAMED("rmw_zenoh_cpp", "Unable to create an SHM provider."); - throw std::runtime_error("Unable to create an SHM provider."); - } - shm_provider_ = provider; - } - auto free_shm_provider = rcpputils::make_scope_exit( - [this]() { - if (shm_provider_.has_value()) { - z_drop(z_move(shm_provider_.value())); - } - }); + // if (strncmp( + // z_string_data(z_loan(shm_enabled)), + // "true", + // z_string_len(z_loan(shm_enabled))) == 0) + // { + // // TODO(yuyuan): determine the default alignment of SHM + // z_alloc_alignment_t alignment = {5}; + // z_owned_memory_layout_t layout; + // z_memory_layout_new(&layout, SHM_BUFFER_SIZE_MB * 1024 * 1024, alignment); + + // z_owned_shm_provider_t provider; + // if (z_posix_shm_provider_new(&provider, z_loan(layout)) != Z_OK) { + // RMW_ZENOH_LOG_ERROR_NAMED("rmw_zenoh_cpp", "Unable to create an SHM provider."); + // throw std::runtime_error("Unable to create an SHM provider."); + // } + // shm_provider_ = provider; + // } + // auto free_shm_provider = rcpputils::make_scope_exit( + // [this]() { + // if (shm_provider_.has_value()) { + // z_drop(z_move(shm_provider_.value())); + // } + // }); graph_guard_condition_ = std::make_unique(); graph_guard_condition_->implementation_identifier = rmw_zenoh_cpp::rmw_zenoh_identifier; @@ -216,7 +216,7 @@ class rmw_context_impl_s::Data final } close_session.cancel(); - free_shm_provider.cancel(); + // free_shm_provider.cancel(); undeclare_z_sub.cancel(); } diff --git a/rmw_zenoh_cpp/src/rmw_init.cpp b/rmw_zenoh_cpp/src/rmw_init.cpp index b80e7579..ac754aaa 100644 --- a/rmw_zenoh_cpp/src/rmw_init.cpp +++ b/rmw_zenoh_cpp/src/rmw_init.cpp @@ -34,7 +34,6 @@ #include "rmw/init_options.h" #include "rcpputils/scope_exit.hpp" -#include "rcutils/env.h" extern "C" {