THRIFT-3067 C++ cppcheck performance related warnings
Patch: Arijit Chattopadhyay <arijitnit06@gmail.com>
This closes #444
diff --git a/contrib/fb303/TClientInfo.cpp b/contrib/fb303/TClientInfo.cpp
index 5959fb1..1fc6612 100644
--- a/contrib/fb303/TClientInfo.cpp
+++ b/contrib/fb303/TClientInfo.cpp
@@ -154,9 +154,8 @@
}
timespec start;
- double secs = 0.0;
info->getTime(&start);
- secs = (double)(now.tv_sec - start.tv_sec) + (now.tv_nsec - start.tv_nsec)*0.000000001;
+ double secs = (double)(now.tv_sec - start.tv_sec) + (now.tv_nsec - start.tv_nsec)*0.000000001;
char buf[256];
snprintf(buf, sizeof buf, "%d %s %s %.3f %llu", i, addrStr, callStr, secs,
diff --git a/contrib/fb303/cpp/FacebookBase.cpp b/contrib/fb303/cpp/FacebookBase.cpp
index 8003340..3c56975 100644
--- a/contrib/fb303/cpp/FacebookBase.cpp
+++ b/contrib/fb303/cpp/FacebookBase.cpp
@@ -98,7 +98,7 @@
// want our read/write structure to go over the wire
counters_.acquireRead();
for(ReadWriteCounterMap::iterator it = counters_.begin();
- it != counters_.end(); it++)
+ it != counters_.end(); ++it)
{
_return[it->first] = it->second.value;
}
diff --git a/contrib/fb303/cpp/ServiceTracker.cpp b/contrib/fb303/cpp/ServiceTracker.cpp
index 2914ff6..7a61b21 100644
--- a/contrib/fb303/cpp/ServiceTracker.cpp
+++ b/contrib/fb303/cpp/ServiceTracker.cpp
@@ -251,7 +251,7 @@
uint64_t count;
for (iter = checkpointServiceDuration_.begin();
iter != checkpointServiceDuration_.end();
- iter++) {
+ ++iter) {
count = iter->second.first;
handler_->setCounter(string("checkpoint_count_") + iter->first, count);
if (count == 0) {