From 5df6c5248e1c1be3aeaefa10ff9eb9be593ec2fd Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 13 Feb 2023 17:04:40 +0100 Subject: Reduced usage of static as we do in generated code * TAO/tao/PortableServer/Servant_Base.cpp: --- TAO/tao/PortableServer/Servant_Base.cpp | 110 ++++++++------------------------ 1 file changed, 27 insertions(+), 83 deletions(-) diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp index 54d5cff2d9d..8809dfd031a 100644 --- a/TAO/tao/PortableServer/Servant_Base.cpp +++ b/TAO/tao/PortableServer/Servant_Base.cpp @@ -72,7 +72,7 @@ TAO_ServantBase::TAO_ServantBase (const TAO_ServantBase &rhs) TAO_ServantBase & TAO_ServantBase::operator= (const TAO_ServantBase &rhs) { - if (this != &rhs) + if (this != std::addressof(rhs)) { this->optable_ = rhs.optable_; } @@ -97,11 +97,6 @@ TAO_ServantBase::_is_a_skel (TAO_ServerRequest & server_request, TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR(servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval; TAO::SArg_Traits< char *>::in_arg_val _tao_repository_id; @@ -111,8 +106,6 @@ TAO_ServantBase::_is_a_skel (TAO_ServerRequest & server_request, &_tao_repository_id }; - static size_t const nargs = 2; - _is_a_Upcall_Command command ( servant, args); @@ -120,12 +113,12 @@ TAO_ServantBase::_is_a_skel (TAO_ServerRequest & server_request, TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 2 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -135,11 +128,6 @@ TAO_ServantBase::_is_a_thru_poa_skel (TAO_ServerRequest & server_request, TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval; TAO::SArg_Traits< char *>::in_arg_val _tao_repository_id; @@ -149,8 +137,6 @@ TAO_ServantBase::_is_a_thru_poa_skel (TAO_ServerRequest & server_request, &_tao_repository_id }; - static size_t const nargs = 2; - _is_a_thru_poa_Upcall_Command command ( servant, server_request.operation_details (), @@ -159,12 +145,12 @@ TAO_ServantBase::_is_a_thru_poa_skel (TAO_ServerRequest & server_request, TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 2 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -176,11 +162,6 @@ TAO_ServantBase::_non_existent_skel (TAO_ServerRequest & server_request, TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval; TAO::Argument * const args[] = @@ -188,8 +169,6 @@ TAO_ServantBase::_non_existent_skel (TAO_ServerRequest & server_request, &retval }; - static size_t const nargs = 1; - _non_existent_Upcall_Command command ( servant, args); @@ -197,12 +176,12 @@ TAO_ServantBase::_non_existent_skel (TAO_ServerRequest & server_request, TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 1 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -211,11 +190,6 @@ void TAO_ServantBase::_non_existent_thru_poa_skel (TAO_ServerRequest & server_re TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< ::ACE_InputCDR::to_boolean>::ret_val retval; TAO::Argument * const args[] = @@ -223,8 +197,6 @@ void TAO_ServantBase::_non_existent_thru_poa_skel (TAO_ServerRequest & server_re &retval }; - static size_t const nargs = 1; - _non_existent_thru_poa_Upcall_Command command ( servant, server_request.operation_details (), @@ -233,12 +205,12 @@ void TAO_ServantBase::_non_existent_thru_poa_skel (TAO_ServerRequest & server_re TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 1 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -279,11 +251,6 @@ TAO_ServantBase::_component_skel (TAO_ServerRequest & server_request, TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< ::CORBA::Object>::ret_val retval; TAO::Argument * const args[] = @@ -291,8 +258,6 @@ TAO_ServantBase::_component_skel (TAO_ServerRequest & server_request, &retval }; - static size_t const nargs = 1; - _get_component_Upcall_Command command ( servant, args); @@ -300,12 +265,12 @@ TAO_ServantBase::_component_skel (TAO_ServerRequest & server_request, TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 1 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -315,11 +280,6 @@ TAO_ServantBase::_component_thru_poa_skel (TAO_ServerRequest & server_request, TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< ::CORBA::Object>::ret_val retval; TAO::Argument * const args[] = @@ -327,8 +287,6 @@ TAO_ServantBase::_component_thru_poa_skel (TAO_ServerRequest & server_request, &retval }; - static size_t const nargs = 1; - _get_component_thru_poa_Upcall_Command command ( servant, server_request.operation_details (), @@ -337,12 +295,12 @@ TAO_ServantBase::_component_thru_poa_skel (TAO_ServerRequest & server_request, TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 1 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -355,11 +313,6 @@ TAO_ServantBase::_repository_id_skel (TAO_ServerRequest & server_request, TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< char *>::ret_val retval; TAO::Argument * const args[] = @@ -367,8 +320,6 @@ TAO_ServantBase::_repository_id_skel (TAO_ServerRequest & server_request, &retval }; - static size_t const nargs = 1; - _repository_id_Upcall_Command command ( servant, args); @@ -376,12 +327,12 @@ TAO_ServantBase::_repository_id_skel (TAO_ServerRequest & server_request, TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 1 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -391,11 +342,6 @@ TAO_ServantBase::_repository_id_thru_poa_skel (TAO_ServerRequest & server_reques TAO::Portable_Server::Servant_Upcall* TAO_INTERCEPTOR (servant_upcall), TAO_ServantBase *servant) { -#if TAO_HAS_INTERCEPTORS == 1 - static ::CORBA::TypeCode_ptr const * const exceptions = 0; - static ::CORBA::ULong const nexceptions = 0; -#endif /* TAO_HAS_INTERCEPTORS */ - TAO::SArg_Traits< char *>::ret_val retval; TAO::Argument * const args[] = @@ -403,8 +349,6 @@ TAO_ServantBase::_repository_id_thru_poa_skel (TAO_ServerRequest & server_reques &retval }; - static size_t const nargs = 1; - _repository_id_thru_poa_Upcall_Command command ( servant, server_request.operation_details (), @@ -413,12 +357,12 @@ TAO_ServantBase::_repository_id_thru_poa_skel (TAO_ServerRequest & server_reques TAO::Upcall_Wrapper upcall_wrapper; upcall_wrapper.upcall (server_request , args - , nargs + , 1 , command #if TAO_HAS_INTERCEPTORS == 1 , servant_upcall - , exceptions - , nexceptions + , nullptr + , 0 #endif /* TAO_HAS_INTERCEPTORS == 1 */ ); } @@ -494,13 +438,13 @@ TAO_ServantBase::_find (const char *opname, TAO_Stub * TAO_ServantBase::_create_stub () { - TAO_Stub *stub = 0; + TAO_Stub *stub = nullptr; TAO::Portable_Server::POA_Current_Impl *poa_current_impl = static_cast (TAO_TSS_Resources::instance ()->poa_current_impl_); - CORBA::ORB_ptr servant_orb = 0; + CORBA::ORB_ptr servant_orb = nullptr; if (poa_current_impl != 0 && this == poa_current_impl->servant ()) -- cgit v1.2.1