1
0
Fork 0

Fixed CppCheck: (performance) Possible inefficient checking for emptiness.

This commit is contained in:
Kirill Kirilenko 2015-01-17 15:12:14 +03:00
parent 2ce2741968
commit 3dc994f9dc
4 changed files with 5 additions and 5 deletions

View File

@ -197,7 +197,7 @@ void cLightingThread::Execute(void)
{
{
cCSLock Lock(m_CS);
if (m_Queue.size() == 0)
if (m_Queue.empty())
{
cCSUnlock Unlock(Lock);
m_evtItemAdded.Wait();

View File

@ -50,7 +50,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
a_DistanceMin *= a_DistanceMin;// this is because is use square distance
a_DistanceMax *= a_DistanceMax;
if (m_DistanceToMonster.size() <= 0)
if (m_DistanceToMonster.empty())
{
convertMaps();
}

View File

@ -86,7 +86,7 @@ public:
bool TryDequeueItem(ItemType & item)
{
cCSLock Lock(m_CS);
if (m_Contents.size() == 0)
if (m_Contents.empty())
{
return false;
}
@ -101,7 +101,7 @@ public:
ItemType DequeueItem(void)
{
cCSLock Lock(m_CS);
while (m_Contents.size() == 0)
while (m_Contents.empty())
{
cCSUnlock Unlock(Lock);
m_evtAdded.Wait();

View File

@ -764,7 +764,7 @@ void cServer::cNotifyWriteThread::Execute(void)
while (!m_ShouldTerminate)
{
cCSLock Lock(m_CS);
while (m_Clients.size() == 0)
while (m_Clients.empty())
{
cCSUnlock Unlock(Lock);
m_Event.Wait();