Skip to content

Commit

Permalink
Merge pull request #2150 from jwillemsen/jwi-nothrow
Browse files Browse the repository at this point in the history
Make use of std::nothrow
  • Loading branch information
jwillemsen authored Oct 25, 2023
2 parents db9274e + 3e51b28 commit a935e6e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
11 changes: 5 additions & 6 deletions TAO/tao/IORManipulation/IORManip_IIOP_Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,11 @@ TAO_IORManip_IIOP_Filter::filter_and_add (TAO_Profile* profile,
}
else
{
TAO_IIOP_Endpoint *endpoint = 0;
ACE_NEW_NORETURN (endpoint,
TAO_IIOP_Endpoint (endpoints[i].host,
endpoints[i].port,
endpoints[i].priority));
if (endpoint == 0)
TAO_IIOP_Endpoint *endpoint =
new (std::nothrow) TAO_IIOP_Endpoint (endpoints[i].host,
endpoints[i].port,
endpoints[i].priority);
if (!endpoint)
{
new_profile->_decr_refcnt ();
return;
Expand Down
6 changes: 3 additions & 3 deletions TAO/tao/LocateRequest_Invocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ namespace TAO
{
TAO::ORB_Countdown_Time countdown (max_wait_time);

TAO_Synch_Reply_Dispatcher *rd_p = nullptr;
ACE_NEW_NORETURN (rd_p, TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (),
this->details_.reply_service_info ()));
TAO_Synch_Reply_Dispatcher *rd_p =
new (std::nothrow) TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (),
this->details_.reply_service_info ());
if (!rd_p)
{
throw ::CORBA::NO_MEMORY ();
Expand Down
5 changes: 2 additions & 3 deletions TAO/tao/Object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,10 +969,9 @@ operator>> (TAO_InputCDR& cdr, CORBA::Object*& x)
return false;
}

ACE_NEW_NORETURN (x,
CORBA::Object (ior, orb_core));
x = new (std::nothrow) CORBA::Object (ior, orb_core);

if (x == nullptr)
if (!x)
{
// Can't allocate a CORBA Object so delete first the
// memory we already allocated before we return
Expand Down
6 changes: 3 additions & 3 deletions TAO/tao/Synch_Invocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ namespace TAO
{
TAO::ORB_Countdown_Time countdown (max_wait_time);

TAO_Synch_Reply_Dispatcher *rd_p = nullptr;
ACE_NEW_NORETURN (rd_p, TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (),
this->details_.reply_service_info ()));
TAO_Synch_Reply_Dispatcher *rd_p =
new (std::nothrow) TAO_Synch_Reply_Dispatcher (this->resolver_.stub ()->orb_core (),
this->details_.reply_service_info ());
if (!rd_p)
{
throw ::CORBA::NO_MEMORY ();
Expand Down

0 comments on commit a935e6e

Please sign in to comment.