From eafc4f45cc50ba0ed4243f1590a4117d213f142d Mon Sep 17 00:00:00 2001 From: Jorge Perez Date: Fri, 19 Jun 2020 18:40:36 -0300 Subject: [PATCH 1/3] Remove unused check context.c Signed-off-by: Jorge Perez --- rcl/src/rcl/context.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rcl/src/rcl/context.c b/rcl/src/rcl/context.c index 0f6df4da3..b400c09ef 100644 --- a/rcl/src/rcl/context.c +++ b/rcl/src/rcl/context.c @@ -95,11 +95,6 @@ rcl_context_get_rmw_context(rcl_context_t * context) void __cleanup_context(rcl_context_t * context) { - // if null, nothing can be done - if (NULL == context) { - return; - } - // reset the instance id to 0 to indicate "invalid" (should already be 0, but this is defensive) rcutils_atomic_store((atomic_uint_least64_t *)(&context->instance_id_storage), 0); From fd89e8cdb08118539a88934c0a46c4fb05ff50fd Mon Sep 17 00:00:00 2001 From: Jorge Perez Date: Fri, 19 Jun 2020 19:09:20 -0300 Subject: [PATCH 2/3] Add test for functiolaity removed Signed-off-by: Jorge Perez --- rcl/test/rcl/test_context.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rcl/test/rcl/test_context.cpp b/rcl/test/rcl/test_context.cpp index 56a8e0842..3103e5594 100644 --- a/rcl/test/rcl/test_context.cpp +++ b/rcl/test/rcl/test_context.cpp @@ -124,3 +124,7 @@ TEST_F(CLASSNAME(TestContextFixture, RMW_IMPLEMENTATION), nominal) { ret = rcl_init_options_fini(&init_options); EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str; } + +TEST_F(CLASSNAME(TestContextFixture, RMW_IMPLEMENTATION), bad_fini) { + EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_context_fini(nullptr)); +} From 963690e4fd40a2e5db088ccc1808e222b8dc79fe Mon Sep 17 00:00:00 2001 From: Jorge Perez Date: Fri, 19 Jun 2020 19:23:15 -0300 Subject: [PATCH 3/3] Add rcl_reset_error() statement Signed-off-by: Jorge Perez --- rcl/test/rcl/test_context.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rcl/test/rcl/test_context.cpp b/rcl/test/rcl/test_context.cpp index 3103e5594..9ef189fed 100644 --- a/rcl/test/rcl/test_context.cpp +++ b/rcl/test/rcl/test_context.cpp @@ -127,4 +127,5 @@ TEST_F(CLASSNAME(TestContextFixture, RMW_IMPLEMENTATION), nominal) { TEST_F(CLASSNAME(TestContextFixture, RMW_IMPLEMENTATION), bad_fini) { EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, rcl_context_fini(nullptr)); + rcl_reset_error(); }