]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/WorkQueue.h: use empty() instead of size()
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 7 Feb 2013 19:04:39 +0000 (20:04 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 11 Feb 2013 10:38:02 +0000 (11:38 +0100)
Fix warning for usage of out->size() in _void_dequeue(). Use empty()
since it should be prefered as it has, following the standard, a
constant time complexity regardless of the containter type. The
same is not guaranteed for size().

warning from cppchecker was:
[common/WorkQueue.h:97]: (performance) Possible inefficient
  checking for 'queue' emptiness.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/common/WorkQueue.h

index b19a6a20cb35962832e865c20616ded9fb85ce25..ced952c49cd5aa25e60d428424a6e130865c314e 100644 (file)
@@ -94,7 +94,7 @@ public:
     void *_void_dequeue() {
       list<T*> *out(new list<T*>);
       _dequeue(out);
-      if (out->size()) {
+      if (!out->empty()) {
        return (void *)out;
       } else {
        delete out;