Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::move, nullptr, const, layout changes #2325

Merged
merged 11 commits into from
Feb 7, 2025
26 changes: 10 additions & 16 deletions TAO/tao/PortableServer/Active_Object_Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ TAO_Active_Object_Map::is_user_id_in_map (

if (find_result == 0)
{
if (entry->servant_ == 0)
if (entry->servant_ == nullptr)
{
if (entry->priority_ != priority)
{
Expand Down Expand Up @@ -420,7 +420,7 @@ TAO_Unique_Id_Strategy::bind_using_user_id (

if (result == 0)
{
if (servant != 0)
if (servant != nullptr)
{
entry->servant_ = servant;

Expand Down Expand Up @@ -451,24 +451,19 @@ TAO_Unique_Id_Strategy::bind_using_user_id (
if (result == 0)
{
result =
this->active_object_map_->user_id_map_->bind (entry->user_id_,
entry);
this->active_object_map_->user_id_map_->bind (entry->user_id_, entry);
if (result == 0)
{
if (servant != 0)
if (servant != nullptr)
{
result =
this->active_object_map_->servant_map_->bind (
entry->servant_,
entry);
this->active_object_map_->servant_map_->bind (entry->servant_, entry);
}

if (result != 0)
{
this->active_object_map_->user_id_map_->unbind (
entry->user_id_);
this->active_object_map_->id_hint_strategy_->unbind (
*entry);
this->active_object_map_->user_id_map_->unbind (entry->user_id_);
this->active_object_map_->id_hint_strategy_->unbind (*entry);
delete entry;
}
else
Expand Down Expand Up @@ -640,12 +635,11 @@ TAO_Multiple_Id_Strategy::bind_using_user_id (
CORBA::Short priority,
TAO_Active_Object_Map_Entry *&entry)
{
int result =
this->active_object_map_->user_id_map_->find (user_id, entry);
int result = this->active_object_map_->user_id_map_->find (user_id, entry);

if (result == 0)
{
if (servant != 0)
if (servant != nullptr)
{
entry->servant_ = servant;
}
Expand Down Expand Up @@ -944,7 +938,7 @@ TAO_System_Id_With_Unique_Id_Strategy::bind_using_system_id (

if (result == 0)
{
if (servant != 0)
if (servant != nullptr)
{
result =
this->active_object_map_->servant_map_->bind (entry->servant_,
Expand Down
26 changes: 8 additions & 18 deletions TAO/tao/PortableServer/Active_Object_Map.inl
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,25 @@ TAO_Active_Object_Map::bind_using_system_id_returning_system_id (
{
PortableServer::ObjectId id;

int result = this->user_id_map_->create_key (id);
int const result = this->user_id_map_->create_key (id);

if (result == 0)
{
ACE_NEW_RETURN (system_id,
PortableServer::ObjectId (id),
PortableServer::ObjectId (std::move(id)),
-1);
}

return result;
}

TAO_Active_Object_Map_Entry *entry = 0;
TAO_Active_Object_Map_Entry *entry {};

int result =
this->id_assignment_strategy_->bind_using_system_id (servant,
priority,
entry);
int result = this->id_assignment_strategy_->bind_using_system_id (servant, priority, entry);

if (result == 0)
{
result = this->id_hint_strategy_->system_id (system_id,
*entry);
result = this->id_hint_strategy_->system_id (system_id, *entry);
}

return result;
Expand All @@ -57,10 +53,7 @@ TAO_Active_Object_Map::bind_using_system_id_returning_user_id (
{
TAO_Active_Object_Map_Entry *entry = 0;

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

ACE_INLINE int
Expand Down Expand Up @@ -253,7 +243,7 @@ TAO_Active_Object_Map::find_user_id_using_system_id (
if (this->id_hint_strategy_->recover_key (system_id, id) == 0)
{
ACE_NEW_RETURN (user_id,
PortableServer::ObjectId (id),
PortableServer::ObjectId (std::move(id)),
-1);
}

Expand Down
8 changes: 3 additions & 5 deletions TAO/tao/PortableServer/Object_Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,20 +976,18 @@ TAO_Object_Adapter::Active_Hint_Strategy::bind_persistent_poa (
poa_name_out system_name)
{
poa_name name = folded_name;
int result = this->persistent_poa_system_map_.bind_modify_key (poa,
name);
int result = this->persistent_poa_system_map_.bind_modify_key (poa, name);

if (result == 0)
{
result =
this->object_adapter_->persistent_poa_name_map_->bind (folded_name,
poa);
this->object_adapter_->persistent_poa_name_map_->bind (folded_name, poa);

if (result != 0)
this->persistent_poa_system_map_.unbind (name);
else
ACE_NEW_RETURN (system_name,
poa_name (name),
poa_name (std::move(name)),
-1);
}

Expand Down
16 changes: 5 additions & 11 deletions TAO/tao/PortableServer/Object_Adapter.inl
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ TAO_Object_Adapter::find_poa (const poa_name &system_name,
}
else
{
return this->find_transient_poa (system_name,
root,
poa_creation_time,
poa);
return this->find_transient_poa (system_name, root, poa_creation_time, poa);
}
}

Expand All @@ -92,12 +89,12 @@ TAO_Object_Adapter::bind_transient_poa (TAO_Root_POA *poa,
poa_name_out system_name)
{
poa_name name;
int result = this->transient_poa_map_->bind_create_key (poa, name);
int const result = this->transient_poa_map_->bind_create_key (poa, name);

if (result == 0)
{
ACE_NEW_RETURN (system_name,
poa_name (name),
poa_name (std::move(name)),
-1);
}

Expand All @@ -109,9 +106,7 @@ TAO_Object_Adapter::bind_persistent_poa (const poa_name &folded_name,
TAO_Root_POA *poa,
poa_name_out system_name)
{
return this->hint_strategy_->bind_persistent_poa (folded_name,
poa,
system_name);
return this->hint_strategy_->bind_persistent_poa (folded_name, poa, system_name);
}

ACE_INLINE int
Expand All @@ -124,8 +119,7 @@ ACE_INLINE int
TAO_Object_Adapter::unbind_persistent_poa (const poa_name &folded_name,
const poa_name &system_name)
{
return this->hint_strategy_->unbind_persistent_poa (folded_name,
system_name);
return this->hint_strategy_->unbind_persistent_poa (folded_name, system_name);
}

ACE_INLINE TAO_Root_POA *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ namespace TAO
{
PortableServer::Servant default_servant = this->default_servant_.in ();

if (default_servant != 0 &&
if (default_servant != nullptr &&
default_servant == servant)
{
// If they are the same servant, then check if we are in an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,9 @@ namespace TAO
TAO::Portable_Server::POA_Current_Impl &poa_current_impl,
bool &wait_occurred_restart_call)
{
PortableServer::Servant servant = 0;

servant = this->poa_->find_servant (system_id,
servant_upcall,
poa_current_impl);
PortableServer::Servant servant = this->poa_->find_servant (system_id, servant_upcall, poa_current_impl);

if (servant != 0)
if (servant != nullptr)
{
return servant;
}
Expand Down Expand Up @@ -125,8 +121,7 @@ namespace TAO
// will raise an OBJ_ADAPTER system exception for the
// request.
bool may_activate =
this->poa_->is_servant_activation_allowed (servant,
wait_occurred_restart_call);
this->poa_->is_servant_activation_allowed (servant, wait_occurred_restart_call);

if (!may_activate)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ namespace TAO
servant_upcall,
poa_current_impl);

if (servant != 0)
if (servant != nullptr)
{
return servant;
}
Expand Down
34 changes: 17 additions & 17 deletions TAO/tao/PortableServer/Root_POA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ TAO_Root_POA::find_POA (const char *adapter_name,
CORBA::Boolean activate_it)
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

TAO_Root_POA *poa = this->find_POA_i (adapter_name, activate_it);

Expand Down Expand Up @@ -693,7 +693,7 @@ TAO_Root_POA::create_POA (const char *adapter_name,
const CORBA::PolicyList &policies)
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->create_POA_i (adapter_name, poa_manager, policies);
}
Expand All @@ -705,7 +705,7 @@ TAO_Root_POA::servant_to_id (PortableServer::Servant servant)
// If we had upgradeable locks, this would initially be a read lock
//
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->servant_to_id_i (servant);
}
Expand All @@ -721,7 +721,7 @@ PortableServer::Servant
TAO_Root_POA::reference_to_servant (CORBA::Object_ptr reference)
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->reference_to_servant_i (reference);
}
Expand All @@ -740,7 +740,7 @@ PortableServer::POAList *
TAO_Root_POA::the_children ()
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->the_children_i ();
}
Expand All @@ -750,7 +750,7 @@ PortableServer::Servant
TAO_Root_POA::id_to_servant (const PortableServer::ObjectId &oid)
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->id_to_servant_i (oid);
}
Expand All @@ -759,7 +759,7 @@ CORBA::Object_ptr
TAO_Root_POA::id_to_reference (const PortableServer::ObjectId &oid)
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->id_to_reference_i (oid, true);
}
Expand Down Expand Up @@ -1131,7 +1131,7 @@ TAO_Root_POA::activate_object (PortableServer::Servant servant)
bool wait_occurred_restart_call = false;

// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

PortableServer::ObjectId *result =
this->activate_object_i (servant,
Expand Down Expand Up @@ -1387,7 +1387,7 @@ TAO_Root_POA::reference_to_servant_i (CORBA::Object_ptr reference)
this->active_policy_strategies_.request_processing_strategy()->
system_id_to_servant (system_id);

if (servant != 0)
if (servant != nullptr)
{
// ATTENTION: Trick locking here, see class header for details
TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
Expand Down Expand Up @@ -1465,7 +1465,7 @@ TAO_Root_POA::reference_to_id (CORBA::Object_ptr reference)
}

// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

return this->active_policy_strategies_.servant_retention_strategy()->
system_id_to_object_id (system_id);
Expand Down Expand Up @@ -1501,7 +1501,7 @@ TAO_Root_POA::id_to_servant_i (const PortableServer::ObjectId &id)
this->active_policy_strategies_.request_processing_strategy()->
id_to_servant (id);

if (servant != 0)
if (servant != nullptr)
{
// ATTENTION: Trick locking here, see class header for details
TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
Expand Down Expand Up @@ -2316,11 +2316,11 @@ PortableServer::Servant
TAO_Root_POA::get_servant ()
{
// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

PortableServer::Servant servant = this->get_servant_i ();

if (servant != 0)
if (servant != nullptr)
{
// ATTENTION: Trick locking here, see class header for details
TAO::Portable_Server::Non_Servant_Upcall non_servant_upcall (*this);
Expand Down Expand Up @@ -2483,14 +2483,14 @@ TAO_Root_POA::root () const
TAO::ORT_Adapter *
TAO_Root_POA::ORT_adapter ()
{
if (this->ort_adapter_ != 0)
if (this->ort_adapter_ != nullptr)
return this->ort_adapter_;

// Lock access for the duration of this transaction.
TAO_POA_GUARD_RETURN (0);
TAO_POA_GUARD_RETURN (nullptr);

// DCL ..
if (this->ort_adapter_ != 0)
if (this->ort_adapter_ != nullptr)
{
return this->ort_adapter_;
}
Expand All @@ -2501,7 +2501,7 @@ TAO_Root_POA::ORT_adapter ()
CORBA::Policy *
TAO_Root_POA::server_protocol ()
{
return 0;
return nullptr;
}

void
Expand Down
Loading