Skip to content

Commit

Permalink
Use uniform init and nullptr
Browse files Browse the repository at this point in the history
    * TAO/tao/PortableServer/Active_Object_Map.cpp:
    * TAO/tao/PortableServer/Active_Object_Map.inl:
    * TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp:
    * TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp:
    * TAO/tao/PortableServer/IdAssignmentPolicy.cpp:
    * TAO/tao/PortableServer/ImplicitActivationPolicy.cpp:
    * TAO/tao/PortableServer/LifespanPolicy.cpp:
    * TAO/tao/PortableServer/LifespanStrategyPersistent.cpp:
    * TAO/tao/PortableServer/Object_Adapter.cpp:
    * TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp:
    * TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp:
    * TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp:
    * TAO/tao/PortableServer/POA_Current.cpp:
    * TAO/tao/PortableServer/PortableServer_Functions.cpp:
    * TAO/tao/PortableServer/Regular_POA.cpp:
    * TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp:
    * TAO/tao/PortableServer/Servant_Base.cpp:
  • Loading branch information
jwillemsen committed Feb 6, 2025
1 parent 0d56284 commit 4506e73
Show file tree
Hide file tree
Showing 17 changed files with 59 additions and 61 deletions.
30 changes: 14 additions & 16 deletions TAO/tao/PortableServer/Active_Object_Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (
{
TAO_Active_Object_Map::set_system_id_size (creation_parameters);

TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy = 0;
TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy {};

if (unique_id_policy)
{
Expand All @@ -118,7 +118,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (
// Give ownership to the unique pointer.
std::unique_ptr<TAO_Id_Uniqueness_Strategy> new_id_uniqueness_strategy (id_uniqueness_strategy);

TAO_Lifespan_Strategy *lifespan_strategy = 0;
TAO_Lifespan_Strategy *lifespan_strategy {};

if (persistent_id_policy)
{
Expand All @@ -142,7 +142,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (
// Give ownership to the unique pointer.
std::unique_ptr<TAO_Lifespan_Strategy> new_lifespan_strategy (lifespan_strategy);

TAO_Id_Assignment_Strategy *id_assignment_strategy = 0;
TAO_Id_Assignment_Strategy *id_assignment_strategy {};

if (user_id_policy)
{
Expand Down Expand Up @@ -177,7 +177,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (
// Give ownership to the unique pointer.
std::unique_ptr<TAO_Id_Assignment_Strategy> new_id_assignment_strategy (id_assignment_strategy);

TAO_Id_Hint_Strategy *id_hint_strategy = 0;
TAO_Id_Hint_Strategy *id_hint_strategy {};
if ((user_id_policy
|| creation_parameters.allow_reactivation_of_system_ids_)
&& creation_parameters.use_active_hint_in_ids_)
Expand All @@ -199,7 +199,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (
// Give ownership to the unique pointer.
std::unique_ptr<TAO_Id_Hint_Strategy> new_id_hint_strategy (id_hint_strategy);

servant_map *sm = 0;
servant_map *sm {};
if (unique_id_policy)
{
switch (creation_parameters.reverse_object_lookup_strategy_for_unique_id_policy_)
Expand Down Expand Up @@ -233,7 +233,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (
// Give ownership to the unique pointer.
std::unique_ptr<servant_map> new_servant_map (sm);

user_id_map *uim = 0;
user_id_map *uim {};
if (user_id_policy
|| creation_parameters.allow_reactivation_of_system_ids_)
{
Expand Down Expand Up @@ -348,7 +348,7 @@ TAO_Active_Object_Map::is_user_id_in_map (
bool &priorities_match,
bool &deactivated)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
bool result = false;
int const find_result = this->user_id_map_->find (user_id, entry);

Expand Down Expand Up @@ -388,9 +388,8 @@ int
TAO_Unique_Id_Strategy::is_servant_in_map (PortableServer::Servant servant,
bool &deactivated)
{
TAO_Active_Object_Map_Entry *entry = 0;
int result = this->active_object_map_->servant_map_->find (servant,
entry);
TAO_Active_Object_Map_Entry *entry{};
int result = this->active_object_map_->servant_map_->find (servant, entry);
if (result == 0)
{
result = 1;
Expand Down Expand Up @@ -510,9 +509,8 @@ int
TAO_Unique_Id_Strategy::unbind_using_user_id (
const PortableServer::ObjectId &user_id)
{
TAO_Active_Object_Map_Entry *entry = 0;
int result = this->active_object_map_->user_id_map_->unbind (user_id,
entry);
TAO_Active_Object_Map_Entry *entry {};
int result = this->active_object_map_->user_id_map_->unbind (user_id, entry);
if (result == 0)
{
if (TAO_debug_level > 7)
Expand Down Expand Up @@ -558,7 +556,7 @@ TAO_Unique_Id_Strategy::find_user_id_using_servant (
PortableServer::Servant servant,
PortableServer::ObjectId_out user_id)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
int result = this->active_object_map_->servant_map_->find (servant, entry);

if (result == 0)
Expand All @@ -584,7 +582,7 @@ TAO_Unique_Id_Strategy::find_system_id_using_servant (
PortableServer::ObjectId_out system_id,
CORBA::Short &priority)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
int result = this->active_object_map_->servant_map_->find (servant,
entry);
if (result == 0)
Expand Down Expand Up @@ -705,7 +703,7 @@ int
TAO_Multiple_Id_Strategy::unbind_using_user_id (
const PortableServer::ObjectId &user_id)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
int result = this->active_object_map_->user_id_map_->unbind (user_id,
entry);
if (result == 0)
Expand Down
16 changes: 8 additions & 8 deletions TAO/tao/PortableServer/Active_Object_Map.inl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TAO_Active_Object_Map::bind_using_system_id_returning_system_id (
CORBA::Short priority,
PortableServer::ObjectId_out system_id)
{
if (servant == 0 && !this->using_active_maps_)
if (servant == nullptr && !this->using_active_maps_)
{
PortableServer::ObjectId id;

Expand Down Expand Up @@ -51,7 +51,7 @@ TAO_Active_Object_Map::bind_using_system_id_returning_user_id (
CORBA::Short priority,
PortableServer::ObjectId_out user_id)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};

int const result = this->id_assignment_strategy_->bind_using_system_id (servant, priority, entry);
if (result == 0)
Expand All @@ -67,7 +67,7 @@ TAO_Active_Object_Map::bind_using_user_id (
const PortableServer::ObjectId &user_id,
CORBA::Short priority)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
return this->id_uniqueness_strategy_->bind_using_user_id (servant, user_id, priority, entry);
}

Expand All @@ -86,7 +86,7 @@ TAO_Active_Object_Map::find_system_id_using_user_id (
return 0;
}

TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
int result =
this->id_uniqueness_strategy_->bind_using_user_id (0,
user_id,
Expand Down Expand Up @@ -148,7 +148,7 @@ TAO_Active_Object_Map::find_servant_using_user_id (
const PortableServer::ObjectId &user_id,
PortableServer::Servant &servant)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
int result = this->user_id_map_->find (user_id, entry);

if (result == 0)
Expand All @@ -157,7 +157,7 @@ TAO_Active_Object_Map::find_servant_using_user_id (
{
result = -1;
}
else if (entry->servant_ == 0)
else if (entry->servant_ == nullptr)
{
result = -1;
}
Expand Down Expand Up @@ -210,12 +210,12 @@ TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (
PortableServer::ObjectId_out system_id,
CORBA::Short &priority)
{
TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};
int result = this->find_entry_using_user_id (user_id, entry);

if (result == 0)
{
if (entry->servant_ == 0)
if (entry->servant_ == nullptr)
{
result = -1;
}
Expand Down
4 changes: 2 additions & 2 deletions TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace TAO
Collocated_Object_Proxy_Broker::_repository_id (CORBA::Object_ptr target)
{
TAO_Stub *stub = target->_stubobj ();
char * _tao_retval = 0;
char * _tao_retval {};

try
{
Expand Down Expand Up @@ -163,7 +163,7 @@ namespace TAO
CORBA::InterfaceDef_ptr
Collocated_Object_Proxy_Broker::_get_interface (CORBA::Object_ptr target)
{
CORBA::InterfaceDef_ptr _tao_retval = 0;
CORBA::InterfaceDef_ptr _tao_retval {};

TAO_Stub *stub = target->_stubobj ();

Expand Down
2 changes: 1 addition & 1 deletion TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TAO_Default_Servant_Dispatcher::create_Root_POA (const ACE_CString &name,
TAO_ORB_Core &orb_core,
TAO_Object_Adapter *object_adapter)
{
TAO_Root_POA *poa = 0;
TAO_Root_POA *poa {};

ACE_NEW_THROW_EX (poa,
TAO_Root_POA (name,
Expand Down
2 changes: 1 addition & 1 deletion TAO/tao/PortableServer/IdAssignmentPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace TAO
CORBA::Policy_ptr
IdAssignmentPolicy::copy ()
{
IdAssignmentPolicy *copy = 0;
IdAssignmentPolicy *copy {};
ACE_NEW_THROW_EX (copy,
IdAssignmentPolicy (this->value_),
CORBA::NO_MEMORY ());
Expand Down
2 changes: 1 addition & 1 deletion TAO/tao/PortableServer/ImplicitActivationPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace TAO
CORBA::Policy_ptr
ImplicitActivationPolicy::copy ()
{
ImplicitActivationPolicy *copy = 0;
ImplicitActivationPolicy *copy {};
ACE_NEW_THROW_EX (copy,
ImplicitActivationPolicy (this->value_),
CORBA::NO_MEMORY ());
Expand Down
2 changes: 1 addition & 1 deletion TAO/tao/PortableServer/LifespanPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace TAO
CORBA::Policy_ptr
LifespanPolicy::copy ()
{
LifespanPolicy *copy = 0;
LifespanPolicy *copy {};
ACE_NEW_THROW_EX (copy,
LifespanPolicy (this->value_),
CORBA::NO_MEMORY ());
Expand Down
4 changes: 2 additions & 2 deletions TAO/tao/PortableServer/LifespanStrategyPersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace TAO
// In case we build shared, try to load the ImR Client library, in a
// static build we just can't do this, so don't try it, lower layers
// output an error then.
if (adapter == 0)
if (adapter == nullptr)
{
ACE_Service_Config::process_directive (
ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE(
Expand Down Expand Up @@ -147,7 +147,7 @@ namespace TAO
ImR_Client_Adapter *adapter =
ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
TAO_Root_POA::imr_client_adapter_name ());
if (adapter == 0)
if (adapter == nullptr)
{
// couldn't load adapter, already reported error
return CORBA::Object::_nil ();
Expand Down
30 changes: 15 additions & 15 deletions TAO/tao/PortableServer/Object_Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ TAO_Object_Adapter::TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Activ
{
TAO_Object_Adapter::set_transient_poa_name_size (creation_parameters);

Hint_Strategy *hint_strategy = 0;
Hint_Strategy *hint_strategy {};
if (creation_parameters.use_active_hint_in_poa_names_)
ACE_NEW (hint_strategy,
Active_Hint_Strategy (creation_parameters.poa_map_size_));
Expand All @@ -170,7 +170,7 @@ TAO_Object_Adapter::TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Activ

new_hint_strategy->object_adapter (this);

persistent_poa_name_map *ppnm = 0;
persistent_poa_name_map *ppnm {};
switch (creation_parameters.poa_lookup_strategy_for_persistent_id_policy_)
{
case TAO_LINEAR:
Expand All @@ -195,7 +195,7 @@ TAO_Object_Adapter::TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Activ
// Give ownership to the unique pointer.
std::unique_ptr<persistent_poa_name_map> new_persistent_poa_name_map (ppnm);

transient_poa_map *tpm = 0;
transient_poa_map *tpm {};
switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_)
{
#if (TAO_HAS_MINIMUM_POA_MAPS == 0)
Expand Down Expand Up @@ -305,7 +305,7 @@ TAO_Object_Adapter::~TAO_Object_Adapter ()
ACE_Lock *
TAO_Object_Adapter::create_lock (TAO_SYNCH_MUTEX &thread_lock)
{
ACE_Lock *the_lock = 0;
ACE_Lock *the_lock {};
ACE_NEW_RETURN (the_lock,
ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (thread_lock),
0);
Expand Down Expand Up @@ -428,7 +428,7 @@ TAO_Object_Adapter::activate_poa (const poa_name &folded_name,
iterator != end;
++iterator)
{
TAO_Root_POA *current = 0;
TAO_Root_POA *current {};

try
{
Expand Down Expand Up @@ -469,7 +469,7 @@ TAO_Object_Adapter::find_transient_poa (const poa_name &system_name,
result = this->transient_poa_map_->find (system_name, poa);
}

if (poa == 0
if (poa == nullptr
|| (result == 0 && !poa->validate_lifespan (false, poa_creation_time)))
result = -1;

Expand Down Expand Up @@ -504,11 +504,11 @@ TAO_Object_Adapter::locate_servant_i (const TAO::ObjectKey &key)
ACE_FUNCTION_TIMEPROBE (TAO_POA_LOCATE_SERVANT_START);

PortableServer::ObjectId id;
TAO_Root_POA *poa = 0;
TAO_Root_POA *poa {};

this->locate_poa (key, id, poa);

PortableServer::Servant servant = 0;
PortableServer::Servant servant {};
TAO_Servant_Location const servant_location =
poa->locate_servant_i (id, servant);

Expand Down Expand Up @@ -644,22 +644,22 @@ TAO_Object_Adapter::close (int wait_for_completion)
// destroyed. In the case of the POA, this means that all object
// etherealizations have finished and root POA has been destroyed
// (implying that all descendent POAs have also been destroyed).
TAO_Root_POA *root = 0;
TAO_Root_POA *root {};
#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
TAO_POAManager_Factory* factory = 0;
TAO_POAManager_Factory* factory {};
#endif
{
ACE_GUARD (ACE_Lock, ace_mon, this->lock ());
if (this->root_ == 0)
if (this->root_ == nullptr)
return;
root = this->root_;
this->root_ = 0;
this->root_ = nullptr;

#if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
if (this->poa_manager_factory_ == 0)
if (this->poa_manager_factory_ == nullptr)
return;
factory = this->poa_manager_factory_;
this->poa_manager_factory_ = 0;
this->poa_manager_factory_ = nullptr;
#endif
}
CORBA::Boolean etherealize_objects = true;
Expand Down Expand Up @@ -904,7 +904,7 @@ TAO_Object_Adapter::get_collocated_servant (const TAO_MProfile &mp)
TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0)
continue;

TAO_ServantBase *servant = 0;
TAO_ServantBase *servant {};

try
{
Expand Down
4 changes: 2 additions & 2 deletions TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TAO_Binary_Search_OpTable::find (const char *opname,

TAO_operation_db_entry const * const entry = lookup (opname);

if (entry == 0)
if (entry == nullptr)
TAOLIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("TAO_Binary_Search_Table:find failed\n")),
-1);
Expand All @@ -55,7 +55,7 @@ TAO_Binary_Search_OpTable::find (const char *opname,

TAO_operation_db_entry const * const entry = lookup (opname);

if (entry == 0)
if (entry == nullptr)
TAOLIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("TAO_Binary_Search_Table:find failed\n")),
-1);
Expand Down
4 changes: 2 additions & 2 deletions TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TAO_Linear_Search_OpTable::find (const char *opname,
ACE_FUNCTION_TIMEPROBE (TAO_LINEAR_SEARCH_OPTABLE_FIND_START);

TAO_operation_db_entry const * const entry = lookup (opname);
if (entry == 0)
if (entry == nullptr)
TAOLIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("TAO_Linear_Search_Table:find failed\n")),
-1);
Expand All @@ -63,7 +63,7 @@ TAO_Linear_Search_OpTable::find (const char *opname,
ACE_FUNCTION_TIMEPROBE (TAO_LINEAR_SEARCH_OPTABLE_FIND_START);

TAO_operation_db_entry const * const entry = lookup (opname);
if (entry == 0)
if (entry == nullptr)
TAOLIB_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("TAO_Linear_Search_Table:find failed\n")),
-1);
Expand Down
Loading

0 comments on commit 4506e73

Please sign in to comment.