Skip to content

Commit

Permalink
Fixed CppCheck: (performance) Possible inefficient checking for empti…
Browse files Browse the repository at this point in the history
…ness.
  • Loading branch information
UltraCoderRU committed Jan 17, 2015
1 parent 2ce2741 commit 3dc994f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/LightingThread.cpp
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/MobProximityCounter.cpp
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/OSSupport/Queue.h
Expand Up @@ -86,7 +86,7 @@ class cQueue
bool TryDequeueItem(ItemType & item)
{
cCSLock Lock(m_CS);
if (m_Contents.size() == 0)
if (m_Contents.empty())
{
return false;
}
Expand All @@ -101,7 +101,7 @@ class cQueue
ItemType DequeueItem(void)
{
cCSLock Lock(m_CS);
while (m_Contents.size() == 0)
while (m_Contents.empty())
{
cCSUnlock Unlock(Lock);
m_evtAdded.Wait();
Expand Down
2 changes: 1 addition & 1 deletion src/Server.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit 3dc994f

Please sign in to comment.