-
Notifications
You must be signed in to change notification settings - Fork 379
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
Conversation
* TAO/tao/PortableServer/Active_Object_Map.cpp: * TAO/tao/PortableServer/Active_Object_Map.inl: * TAO/tao/PortableServer/Object_Adapter.cpp: * TAO/tao/PortableServer/Object_Adapter.inl: * TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp: * TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp: * TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp: * TAO/tao/PortableServer/Root_POA.cpp:
WalkthroughThis pull request modernizes the code by replacing integer-based null pointer checks with Changes
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
TAO/tao/PortableServer/Active_Object_Map.inl (1)
24-24
: Improve code quality with modern C++ features.Good improvements:
- Making
result
const as it's not modified after initialization- Using brace initialization for pointers instead of
= 0
Also applies to: 36-36
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
TAO/tao/PortableServer/Active_Object_Map.cpp
(5 hunks)TAO/tao/PortableServer/Active_Object_Map.inl
(4 hunks)TAO/tao/PortableServer/Object_Adapter.cpp
(1 hunks)TAO/tao/PortableServer/Object_Adapter.inl
(4 hunks)TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
(1 hunks)TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp
(2 hunks)TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp
(1 hunks)TAO/tao/PortableServer/Root_POA.cpp
(14 hunks)
✅ Files skipped from review due to trivial changes (4)
- TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp
- TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
- TAO/tao/PortableServer/Object_Adapter.inl
- TAO/tao/PortableServer/Object_Adapter.cpp
⏰ Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
- GitHub Check: ubuntu-20.04 clang++-10
- GitHub Check: VS2022Release64
- GitHub Check: VS2022Debug64
- GitHub Check: VS2022WChar
- GitHub Check: VS2019Debug64Cxx20
- GitHub Check: VS2019Debug64Cxx17
- GitHub Check: VS2019Release32
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: VS2019Debug32
- GitHub Check: VS2019Release64
- GitHub Check: VS2019Debug64
- GitHub Check: VS2019WChar
- GitHub Check: MINGW64-gcc
- GitHub Check: windows-2019 vs2019
- GitHub Check: macos-14-C++
- GitHub Check: ubuntu-20.04 g++-10
- GitHub Check: alpine-3.18
- GitHub Check: ubuntu-22.04 g++-12
- GitHub Check: macos-13-C++
🔇 Additional comments (6)
TAO/tao/PortableServer/Active_Object_Map.inl (1)
29-29
: Optimize object transfers with std::move.Good use of move semantics to avoid unnecessary copying of the
id
object when constructingPortableServer::ObjectId
.Also applies to: 246-246
TAO/tao/PortableServer/RequestProcessingStrategyServantActivator.cpp (1)
87-89
: Improve code clarity with modern pointer handling.Good improvements:
- Combined initialization and assignment of servant
- Using
nullptr
for pointer comparison instead of0
TAO/tao/PortableServer/Active_Object_Map.cpp (1)
357-357
: Modernize pointer comparisons consistently.Good consistent replacement of
0
withnullptr
for pointer comparisons throughout the file, improving code clarity and type safety.Also applies to: 423-423, 457-457, 941-941
TAO/tao/PortableServer/Root_POA.cpp (3)
603-603
: Modernize guard return values.Good consistent update of TAO_POA_GUARD_RETURN statements to return
nullptr
instead of0
, improving type safety.Also applies to: 696-696, 734-734, 753-753, 762-762, 1134-1134, 1468-1468, 2490-2490
1390-1390
: Improve pointer comparisons with nullptr.Good consistent replacement of
0
withnullptr
for pointer comparisons, enhancing code clarity and type safety.Also applies to: 1323-1323, 2486-2486, 2493-2493
2504-2504
: Return nullptr from server_protocol.Good update to return
nullptr
instead of0
from the server_protocol method.
* 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:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (13)
TAO/tao/PortableServer/Regular_POA.cpp (1)
35-35
: Consider modernizing remaining null checks.For consistency with the PR's objectives and the modernization already done on line 48, consider updating the remaining null checks to use
nullptr
:- if (this->parent_ != 0) + if (this->parent_ != nullptr)- if (this->parent_ != 0) + if (this->parent_ != nullptr)Also applies to: 54-54
TAO/tao/PortableServer/PortableServer_Functions.cpp (1)
35-41
: Consider further modernization opportunities.There are additional opportunities to modernize the code:
- Initialize the
id
pointer withnullptr
instead of0
- Use
nullptr
instead of0
in the error return- Consider using smart pointers for better memory management
- PortableServer::ObjectId *id = 0; + PortableServer::ObjectId *id = nullptr; ACE_NEW_RETURN (id, PortableServer::ObjectId (buffer_size, buffer_size, buffer, 1), - 0); + nullptr);TAO/tao/PortableServer/Servant_Base.cpp (1)
441-449
: Consider modernizing additional null pointer checks for consistency.For consistency with the modernization effort, consider updating the following:
- Line 449: Replace
poa_current_impl != 0
withpoa_current_impl != nullptr
- if (poa_current_impl != 0 + if (poa_current_impl != nullptrTAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp (3)
53-53
: Consider usingnullptr
for pointer initialization.While using
{}
for zero-initialization is valid, usingnullptr
would be more idiomatic for pointer types in modern C++.- char * _tao_retval {}; + char * _tao_retval {nullptr};
166-166
: Consider usingnullptr
for pointer initialization.While using
{}
for zero-initialization is valid, usingnullptr
would be more idiomatic for pointer types in modern C++.- CORBA::InterfaceDef_ptr _tao_retval {}; + CORBA::InterfaceDef_ptr _tao_retval {nullptr};
20-22
: Consider modernizing null checks withnullptr
.For consistency with modern C++ practices, consider updating the null checks throughout the file to use
nullptr
instead of0
.- if (stub != 0 && + if (stub != nullptr &&This change should be applied to all similar checks in the file (lines 20, 58, 96, 134, 173, 193).
Also applies to: 58-60, 96-98, 134-136, 173-175, 193-193
TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp (2)
12-35
: Consider additional C++ modernization opportunities.While the pointer initialization change is good, there are a few more modernization opportunities in this method:
- Replace the
0
withnullptr
in the TAO_Root_POA constructor call- Mark the string and policy set parameters as const references
Here's the suggested improvement:
TAO_Root_POA * -TAO_Default_Servant_Dispatcher::create_Root_POA (const ACE_CString &name, +TAO_Default_Servant_Dispatcher::create_Root_POA (const ACE_CString &name, PortableServer::POAManager_ptr poa_manager, - const TAO_POA_Policy_Set &policies, + const TAO_POA_Policy_Set &policies, ACE_Lock &lock, TAO_SYNCH_MUTEX &thread_lock, TAO_ORB_Core &orb_core, TAO_Object_Adapter *object_adapter) { TAO_Root_POA *poa {}; ACE_NEW_THROW_EX (poa, TAO_Root_POA (name, poa_manager, policies, - 0, + nullptr, lock, thread_lock, orb_core, object_adapter), CORBA::NO_MEMORY ()); return poa; }
8-10
: Consider defaulting the empty destructor.The empty destructor could be defaulted using
= default
for better maintainability.-TAO_Default_Servant_Dispatcher::~TAO_Default_Servant_Dispatcher () -{ -} +TAO_Default_Servant_Dispatcher::~TAO_Default_Servant_Dispatcher () = default;TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp (1)
39-39
: Consider modernizing the skeleton function initialization.While updating null pointer checks, consider also modernizing the skeleton function initialization.
- skelfunc = 0; // insure that somebody can't call a wrong function! + skelfunc = nullptr; // ensure that somebody can't call a wrong function!Note: Also fixed the typo in the comment (insure → ensure).
Also applies to: 64-64
TAO/tao/PortableServer/LifespanPolicy.cpp (1)
24-24
: Good modernization of pointer initialization!The change from
0
to{}
for pointer initialization aligns with modern C++ practices. Consider also marking thecopy
method asconst
since it doesn't modify the object's state.- CORBA::Policy_ptr - LifespanPolicy::copy () + CORBA::Policy_ptr + LifespanPolicy::copy () constTAO/tao/PortableServer/IdAssignmentPolicy.cpp (1)
23-23
: Good modernization of pointer initialization!The change from
0
to{}
for pointer initialization aligns with modern C++ practices. Consider also marking thecopy
method asconst
since it doesn't modify the object's state.- CORBA::Policy_ptr - IdAssignmentPolicy::copy () + CORBA::Policy_ptr + IdAssignmentPolicy::copy () constTAO/tao/PortableServer/ImplicitActivationPolicy.cpp (2)
22-22
: Good modernization of pointer initialization!The change from
0
to{}
for pointer initialization aligns with modern C++ practices. Consider also marking thecopy
method asconst
since it doesn't modify the object's state.- CORBA::Policy_ptr - ImplicitActivationPolicy::copy () + CORBA::Policy_ptr + ImplicitActivationPolicy::copy () const
1-64
: Consider applying consistent improvements across all Policy classes.The systematic modernization of pointer initialization is good. Consider creating a follow-up PR to:
- Mark all Policy class
copy
methods asconst
- Consider using
std::make_unique
or similar smart pointer patterns if memory management modernization is within scope
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (17)
TAO/tao/PortableServer/Active_Object_Map.cpp
(16 hunks)TAO/tao/PortableServer/Active_Object_Map.inl
(8 hunks)TAO/tao/PortableServer/Collocated_Object_Proxy_Broker.cpp
(2 hunks)TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp
(1 hunks)TAO/tao/PortableServer/IdAssignmentPolicy.cpp
(1 hunks)TAO/tao/PortableServer/ImplicitActivationPolicy.cpp
(1 hunks)TAO/tao/PortableServer/LifespanPolicy.cpp
(1 hunks)TAO/tao/PortableServer/LifespanStrategyPersistent.cpp
(2 hunks)TAO/tao/PortableServer/Object_Adapter.cpp
(10 hunks)TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp
(2 hunks)TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp
(2 hunks)TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp
(2 hunks)TAO/tao/PortableServer/POA_Current.cpp
(4 hunks)TAO/tao/PortableServer/PortableServer_Functions.cpp
(1 hunks)TAO/tao/PortableServer/Regular_POA.cpp
(1 hunks)TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp
(2 hunks)TAO/tao/PortableServer/Servant_Base.cpp
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- TAO/tao/PortableServer/POA_Current.cpp
🚧 Files skipped from review as they are similar to previous changes (4)
- TAO/tao/PortableServer/RequestProcessingStrategyServantLocator.cpp
- TAO/tao/PortableServer/Object_Adapter.cpp
- TAO/tao/PortableServer/Active_Object_Map.cpp
- TAO/tao/PortableServer/Active_Object_Map.inl
⏰ Context from checks skipped due to timeout of 90000ms (21)
- GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
- GitHub Check: macos-13-C++
- GitHub Check: ubuntu-20.04 clang++-13
- GitHub Check: ubuntu-20.04 clang++-11
- GitHub Check: ubuntu-20.04 clang++-10
- GitHub Check: ubuntu-24.04 g++-13
- GitHub Check: VS2022Release64
- GitHub Check: VS2022Debug64
- GitHub Check: VS2022WChar
- GitHub Check: VS2019Debug64Cxx20
- GitHub Check: VS2019Debug64Cxx17
- GitHub Check: VS2019Release32
- GitHub Check: VS2019Debug32
- GitHub Check: VS2019Release64
- GitHub Check: VS2019Debug64
- GitHub Check: VS2019WChar
- GitHub Check: MINGW64-gcc
- GitHub Check: alpine-3.18
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: windows-2019 vs2019
- GitHub Check: ubuntu-20.04 g++-10
🔇 Additional comments (8)
TAO/tao/PortableServer/Regular_POA.cpp (1)
48-48
: LGTM! Good use of nullptr.The change from
0
tonullptr
improves code clarity by using modern C++ null pointer semantics.TAO/tao/PortableServer/LifespanStrategyPersistent.cpp (1)
75-75
: LGTM! Good modernization of pointer checks.The changes to use
nullptr
instead of0
for pointer comparisons improve type safety and readability.Also applies to: 150-150
TAO/tao/PortableServer/PortableServer_Functions.cpp (1)
15-15
: LGTM! Good modernization of null pointer check.The change from
0
tonullptr
improves type safety and readability, aligning with modern C++ practices.TAO/tao/PortableServer/Servant_Base.cpp (1)
392-392
: LGTM! Good modernization of null pointer check.The change from
0
tonullptr
improves type safety and readability, aligning with modern C++ best practices.TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp (1)
21-21
: LGTM! Modern pointer initialization.The use of brace initialization for the pointer is a good modernization that improves clarity and safety.
TAO/tao/PortableServer/Operation_Table_Binary_Search.cpp (1)
38-38
: LGTM! Good modernization of null pointer checks.The changes from
0
tonullptr
align with modern C++ practices and improve code clarity.Also applies to: 58-58
TAO/tao/PortableServer/Operation_Table_Linear_Search.cpp (1)
45-45
: LGTM! Consistent modernization across operation table implementations.The null pointer check updates maintain consistency with the binary search implementation.
Also applies to: 66-66
TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp (1)
37-37
: LGTM! Consistent modernization of null pointer checks.The changes align with modern C++ practices and maintain consistency across all operation table implementations.
Also applies to: 62-62
* TAO/tao/PortableServer/LifespanStrategyPersistent.cpp: * TAO/tao/PortableServer/Root_POA.cpp:
* TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp: * TAO/tao/PortableServer/Default_Servant_Dispatcher.h: * TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp: * TAO/tao/PortableServer/PortableServer_Functions.cpp: * TAO/tao/PortableServer/PortableServer_WFunctions.cpp: * TAO/tao/PortableServer/Regular_POA.cpp: * TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp: * TAO/tao/PortableServer/Servant_Base.cpp:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
TAO/tao/PortableServer/PortableServer_WFunctions.cpp (1)
9-37
: Consider adding safety checks for memory operations.The function could benefit from additional safety measures:
- Add bounds checking for
string_length
to prevent overflow- Add error handling for
allocbuf
to handle allocation failures- Consider using RAII or smart pointers to manage memory
Example improvement:
PortableServer::ObjectId * wstring_to_ObjectId(const CORBA::WChar *string) { if (!string) { throw CORBA::BAD_PARAM(); } // Check for overflow u_int string_length = ACE_OS::wslen(string); if (string_length > std::numeric_limits<CORBA::ULong>::max() / sizeof(CORBA::WChar)) { throw CORBA::BAD_PARAM(); } CORBA::ULong buffer_size = string_length * sizeof(CORBA::WChar); // Use try/catch or error checking for allocation CORBA::Octet *buffer = nullptr; try { buffer = PortableServer::ObjectId::allocbuf(buffer_size); if (!buffer) { throw CORBA::NO_MEMORY(); } } catch (...) { throw CORBA::NO_MEMORY(); } ACE_OS::memcpy(buffer, string, buffer_size); PortableServer::ObjectId *id{}; ACE_NEW_RETURN(id, PortableServer::ObjectId(buffer_size, buffer_size, buffer, 1), nullptr); return id; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp
(1 hunks)TAO/tao/PortableServer/Default_Servant_Dispatcher.h
(1 hunks)TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp
(2 hunks)TAO/tao/PortableServer/PortableServer_Functions.cpp
(2 hunks)TAO/tao/PortableServer/PortableServer_WFunctions.cpp
(1 hunks)TAO/tao/PortableServer/Regular_POA.cpp
(2 hunks)TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
(2 hunks)TAO/tao/PortableServer/Servant_Base.cpp
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- TAO/tao/PortableServer/Default_Servant_Dispatcher.h
🚧 Files skipped from review as they are similar to previous changes (6)
- TAO/tao/PortableServer/Regular_POA.cpp
- TAO/tao/PortableServer/Servant_Base.cpp
- TAO/tao/PortableServer/PortableServer_Functions.cpp
- TAO/tao/PortableServer/RequestProcessingStrategyDefaultServant.cpp
- TAO/tao/PortableServer/Operation_Table_Perfect_Hash.cpp
- TAO/tao/PortableServer/Default_Servant_Dispatcher.cpp
⏰ Context from checks skipped due to timeout of 90000ms (19)
- GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
- GitHub Check: ubuntu-20.04 clang++-11
- GitHub Check: ubuntu-20.04 clang++-10
- GitHub Check: VS2022Release64
- GitHub Check: VS2022Debug64
- GitHub Check: VS2022WChar
- GitHub Check: VS2019Debug64Cxx20
- GitHub Check: VS2019Debug64Cxx17
- GitHub Check: VS2019Release32
- GitHub Check: VS2019Debug32
- GitHub Check: VS2019Release64
- GitHub Check: ubuntu-20.04 g++-10
- GitHub Check: VS2019Debug64
- GitHub Check: VS2019WChar
- GitHub Check: MINGW64-gcc
- GitHub Check: alpine-3.18
- GitHub Check: windows-2019 vs2019
- GitHub Check: macos-14-C++
- GitHub Check: macos-13-C++
🔇 Additional comments (2)
TAO/tao/PortableServer/PortableServer_WFunctions.cpp (2)
28-28
: LGTM! Good use of modern C++ initialization.Using
{}
for pointer initialization is a modern C++ practice that provides more consistent initialization syntax and prevents narrowing conversions.
34-34
: LGTM! Good use of nullptr.Using
nullptr
instead of0
for pointer values improves type safety and makes the code's intent more explicit.
* TAO/tao/PortableServer/Network_Priority_Hook.h: * TAO/tao/PortableServer/Object_Adapter.cpp: * TAO/tao/PortableServer/Object_Adapter.h: * TAO/tao/PortableServer/POA_Cached_Policies.cpp: * TAO/tao/PortableServer/POA_Cached_Policies.h: * TAO/tao/PortableServer/POA_Policy_Set.cpp: * TAO/tao/PortableServer/POA_Policy_Set.h: * TAO/tao/PortableServer/Servant_Base.cpp: * TAO/tao/PortableServer/Servant_Base.h:
* TAO/tao/PortableServer/Object_Adapter.h:
* TAO/tao/PortableServer/Network_Priority_Hook.h:
* TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.cpp: * TAO/tao/DiffServPolicy/DiffServ_Network_Priority_Hook.h: * TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.cpp: * TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h:
* TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp: * TAO/tao/EndpointPolicy/EndpointPolicy_i.h: * TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp: * TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h: * TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp: * TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h:
* TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h:
* TAO/tao/PortableServer/Network_Priority_Hook.cpp:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp (2)
20-24
: Add const qualifier to policy_type method.This method doesn't modify any class state and should be marked as const.
-CORBA::PolicyType -TAO_EndpointPolicy_i::policy_type () +CORBA::PolicyType +TAO_EndpointPolicy_i::policy_type () const
50-56
: Consider using nullptr in ACE_NEW_THROW_EX.While the initialization with
{}
is good, consider usingnullptr
consistently across all memory allocation macros.- ACE_NEW_THROW_EX (servant, - TAO_EndpointPolicy_i (*this), - CORBA::NO_MEMORY ()); + ACE_NEW_THROW_EX (servant, + TAO_EndpointPolicy_i (*this), + CORBA::NO_MEMORY (nullptr));TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp (3)
16-16
: Consider using nullptr for pointer initialization.Replace
0
withnullptr
for pointer initialization to follow modern C++ practices.- TAO_Acceptor_Filter* filter = 0; + TAO_Acceptor_Filter* filter = nullptr;
23-24
: Use nullptr for return value.Replace
0
withnullptr
when returning a pointer type.- return 0; + return nullptr;
39-48
: Use nullptr in ACE_NEW_RETURN calls.Replace
0
withnullptr
in error handling of memory allocation.if (endpoints.length () > 0) ACE_NEW_RETURN (filter, TAO_Endpoint_Acceptor_Filter (endpoints), - 0); + nullptr); else // no policy was in force, just return a default filter ACE_NEW_RETURN (filter, TAO_Default_Acceptor_Filter (), - 0); + nullptr);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h
(2 hunks)TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp
(1 hunks)TAO/tao/EndpointPolicy/EndpointPolicy_i.h
(1 hunks)TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.cpp
(1 hunks)TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h
(1 hunks)TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp
(2 hunks)TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h
(1 hunks)TAO/tao/PortableServer/Network_Priority_Hook.cpp
(0 hunks)
💤 Files with no reviewable changes (1)
- TAO/tao/PortableServer/Network_Priority_Hook.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
- TAO/tao/DiffServPolicy/DiffServ_Protocols_Hooks.h
⏰ Context from checks skipped due to timeout of 90000ms (21)
- GitHub Check: ubuntu-20.04 g++-10 ACE for TAO
- GitHub Check: ubuntu-20.04 clang++-11
- GitHub Check: ubuntu-20.04 clang++-10
- GitHub Check: ubuntu-24.04 g++-13
- GitHub Check: VS2022Release64
- GitHub Check: VS2022Debug64
- GitHub Check: VS2022WChar
- GitHub Check: VS2019Debug64Cxx20
- GitHub Check: VS2019Debug64Cxx17
- GitHub Check: VS2019Release32
- GitHub Check: VS2019Debug32
- GitHub Check: VS2019Release64
- GitHub Check: VS2019Debug64
- GitHub Check: VS2019WChar
- GitHub Check: MINGW64-gcc
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: macos-14-C++
- GitHub Check: windows-2019 vs2019
- GitHub Check: macos-13-C++
- GitHub Check: alpine-3.18
- GitHub Check: ubuntu-20.04 g++-10
🔇 Additional comments (6)
TAO/tao/EndpointPolicy/EndpointPolicy_i.cpp (1)
29-33
: LGTM! Good use of modern C++ initialization.The use of
{}
for pointer initialization andnullptr
for error handling is a good modernization practice.TAO/tao/EndpointPolicy/Endpoint_Acceptor_Filter_Factory.h (1)
40-40
: LGTM! Good use of default destructor.Using
= default
for the destructor is a good modern C++ practice when no custom cleanup is needed.TAO/tao/EndpointPolicy/EndpointPolicy_i.h (1)
53-53
: LGTM! Good use of default destructor.Using
= default
for the destructor is a good modern C++ practice when no custom cleanup is needed.TAO/tao/EndpointPolicy/IIOPEndpointValue_i.cpp (2)
31-32
: LGTM! Good modernization of pointer check and boolean return.The changes improve code clarity by using
nullptr
for pointer comparison andfalse
for boolean return, which is more idiomatic in modern C++.
53-53
: LGTM! Good modernization of pointer check.The change improves code clarity by using
nullptr
for pointer comparison, which is more idiomatic in modern C++.TAO/tao/EndpointPolicy/IIOPEndpointValue_i.h (1)
69-69
: LGTM! Good use of default destructor.The change to use
= default
is appropriate as the class doesn't need custom cleanup. The virtual destructor is correctly maintained for the virtual inheritance hierarchy, and all member variables have proper destructors.
Summary by CodeRabbit
These updates maintain existing functionality while contributing to a more stable and efficient system for end-users.