]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
PrioritizedQueue: move if check out of loop in filter_list_pairs
authorSamuel Just <sam.just@inktank.com>
Tue, 11 Dec 2012 01:30:59 +0000 (17:30 -0800)
committerSamuel Just <sam.just@inktank.com>
Tue, 11 Dec 2012 01:30:59 +0000 (17:30 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/common/PrioritizedQueue.h

index 7a7348267c045cf7ad30ed50d307670680fd469e..7508e1449768c560a3d119fbaeb9d89b6f9ea1ce 100644 (file)
@@ -51,10 +51,10 @@ class PrioritizedQueue {
     list<pair<unsigned, T> > *l, F f,
     list<T> *out) {
     unsigned ret = 0;
-    for (typename list<pair<unsigned, T> >::reverse_iterator i = l->rbegin();
-        i != l->rend();
-        ++i) {
-      if (out) {
+    if (out) {
+      for (typename list<pair<unsigned, T> >::reverse_iterator i = l->rbegin();
+          i != l->rend();
+          ++i) {
        if (f(i->second)) {
          out->push_front(i->second);
        }