summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-11-12 20:08:59 (GMT)
committerRemko Tronçon <git@el-tramo.be>2012-11-12 20:18:11 (GMT)
commitdce792fe9583fcb99b5367c089e749aef269d6e9 (patch)
tree045b49d93a436cfe7bce888e655c63a07107f939
parent9b83adf9eb38d10f8cd1108d4c608117a1f8459d (diff)
downloadswift-dce792fe9583fcb99b5367c089e749aef269d6e9.zip
swift-dce792fe9583fcb99b5367c089e749aef269d6e9.tar.bz2
Use more efficient empty check.
Change-Id: I8690af82a7f73d3883057b2a58a19197d6b09842
-rw-r--r--Swiften/EventLoop/SingleThreadedEventLoop.cpp2
-rw-r--r--Swiften/Whiteboard/WhiteboardClient.cpp8
-rw-r--r--Swiften/Whiteboard/WhiteboardServer.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/Swiften/EventLoop/SingleThreadedEventLoop.cpp b/Swiften/EventLoop/SingleThreadedEventLoop.cpp
index 4c5e209..c2235b1 100644
--- a/Swiften/EventLoop/SingleThreadedEventLoop.cpp
+++ b/Swiften/EventLoop/SingleThreadedEventLoop.cpp
@@ -27,7 +27,7 @@ SingleThreadedEventLoop::~SingleThreadedEventLoop() {
void SingleThreadedEventLoop::waitForEvents() {
boost::unique_lock<boost::mutex> lock(eventsMutex_);
- while (events_.size() == 0 && !shouldShutDown_) {
+ while (events_.empty() && !shouldShutDown_) {
eventsAvailable_.wait(lock);
}
diff --git a/Swiften/Whiteboard/WhiteboardClient.cpp b/Swiften/Whiteboard/WhiteboardClient.cpp
index 8fad22e..c17b9f9 100644
--- a/Swiften/Whiteboard/WhiteboardClient.cpp
+++ b/Swiften/Whiteboard/WhiteboardClient.cpp
@@ -27,7 +27,7 @@ namespace Swift {
op = boost::make_shared<WhiteboardDeleteOperation>(*deleteOp);
}
- if (bridge_.size() > 0) {
+ if (!bridge_.empty()) {
op->setParentID(bridge_.back()->getID());
}
bridge_.push_back(op);
@@ -48,7 +48,7 @@ namespace Swift {
}
- if (serverOperations_.size() > 0) {
+ if (!serverOperations_.empty()) {
op->setParentID(serverOperations_.back()->getID());
}
lastSentOperationID_ = operation->getID();
@@ -69,11 +69,11 @@ namespace Swift {
result.client = operation;
} else if (lastSentOperationID_ == operation->getID()) {
//Client received confirmation about own operation and it sends next operation to server
- if (bridge_.size() > 0 && lastSentOperationID_ == bridge_.front()->getID()) {
+ if (!bridge_.empty() && lastSentOperationID_ == bridge_.front()->getID()) {
bridge_.erase(bridge_.begin());
}
- if (bridge_.size() > 0 && (bridge_.front())->getParentID() == lastSentOperationID_) {
+ if (!bridge_.empty() && (bridge_.front())->getParentID() == lastSentOperationID_) {
lastSentOperationID_ = (bridge_.front())->getID();
result.server = bridge_.front();
}
diff --git a/Swiften/Whiteboard/WhiteboardServer.cpp b/Swiften/Whiteboard/WhiteboardServer.cpp
index be595fd..94f8cff 100644
--- a/Swiften/Whiteboard/WhiteboardServer.cpp
+++ b/Swiften/Whiteboard/WhiteboardServer.cpp
@@ -15,7 +15,7 @@ namespace Swift {
WhiteboardOperation::ref WhiteboardServer::handleClientOperationReceived(WhiteboardOperation::ref newOperation) {
std::list<WhiteboardOperation::ref>::reverse_iterator it;
- if (operations_.size() == 0 || newOperation->getParentID() == operations_.back()->getID()) {
+ if (operations_.empty() || newOperation->getParentID() == operations_.back()->getID()) {
operations_.push_back(newOperation);
return newOperation;
}