No need to go through the list when you just want the size
authorYang Chi <yangchi@fb.com>
Tue, 26 Jul 2016 20:45:01 +0000 (13:45 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Tue, 26 Jul 2016 20:53:30 +0000 (13:53 -0700)
Summary: cb is an unused variable, and i got error in android. It seems like we don't need to go through the list to increase count.

Differential Revision: D3622772

fbshipit-source-id: fe1f81a1fcad5bacad052e14b7b0b370beb3f3e5

folly/io/async/HHWheelTimer.cpp

index 55d489b5272c53de4eedf4cbdf7c33972d5f5c7d..9918f9dd9e43a0d43dace3853788415560182326 100644 (file)
@@ -237,9 +237,7 @@ size_t HHWheelTimer::cancelAll() {
         if (bucket.empty()) {
           continue;
         }
-        for (auto& cb : bucket) {
-          count++;
-        }
+        count += bucket.size();
         std::swap(bucket, buckets[countBuckets++]);
         if (count >= count_) {
           break;