Remove unused check context.c (#691)

* Remove unused check context.c
* Add test for functionality removed
* Add rcl_reset_error() statement

Signed-off-by: Jorge Perez <jjperez@ekumenlabs.com>
This commit is contained in:
Jorge Perez 2020-06-22 10:24:06 -03:00 committed by Alejandro Hernández Cordero
parent 91dad10c1e
commit dda5103935
2 changed files with 5 additions and 5 deletions

View file

@ -95,11 +95,6 @@ rcl_context_get_rmw_context(rcl_context_t * context)
void void
__cleanup_context(rcl_context_t * context) __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) // 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); rcutils_atomic_store((atomic_uint_least64_t *)(&context->instance_id_storage), 0);

View file

@ -124,3 +124,8 @@ TEST_F(CLASSNAME(TestContextFixture, RMW_IMPLEMENTATION), nominal) {
ret = rcl_init_options_fini(&init_options); ret = rcl_init_options_fini(&init_options);
EXPECT_EQ(RCL_RET_OK, ret) << rcl_get_error_string().str; 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));
rcl_reset_error();
}