Ack, Mathi. > -----Original Message----- > From: Anders Widell [mailto:anders.wid...@ericsson.com] > Sent: Thursday, April 21, 2016 2:17 PM > To: Mathivanan Naickan Palanivelu > Cc: opensaf-devel@lists.sourceforge.net > Subject: [PATCH 1 of 1] clm: Use the empty() method to check if a set is > empty [#1773] > > osaf/services/saf/clmsv/nodeagent/election_starter.cc | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > > The empty() method should be used to check if a set is empty, instead of > comparing the result of the size() method with zero. Depending on the STL > implementation, the std::set::size() method can take linear time. > > This bug was found using the cppcheck tool. > > diff --git a/osaf/services/saf/clmsv/nodeagent/election_starter.cc > b/osaf/services/saf/clmsv/nodeagent/election_starter.cc > --- a/osaf/services/saf/clmsv/nodeagent/election_starter.cc > +++ b/osaf/services/saf/clmsv/nodeagent/election_starter.cc > @@ -122,8 +122,8 @@ timespec ElectionStarter::Poll() { > > timespec ElectionStarter::CalculateTimeRemainingUntilNextEvent() const { > timespec timeout; > - if (controller_nodes_.tree.size() == 0 && > - nodes_with_lower_node_id_.tree.size() == 0) { > + if (controller_nodes_.tree.empty() && > + nodes_with_lower_node_id_.tree.empty()) { > timeout = > base::Max(controller_nodes_.last_change + election_delay_time_, > nodes_with_lower_node_id_.last_change + > election_delay_time_,
------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel