From: Danny Al-Gaaf Date: Thu, 7 Feb 2013 19:04:39 +0000 (+0100) Subject: common/WorkQueue.h: use empty() instead of size() X-Git-Tag: v0.58~109^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=698670726ad0a8c64b84c893b0a46cbf8b3442df;p=ceph.git common/WorkQueue.h: use empty() instead of size() 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 --- diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index b19a6a20cb35..ced952c49cd5 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -94,7 +94,7 @@ public: void *_void_dequeue() { list *out(new list); _dequeue(out); - if (out->size()) { + if (!out->empty()) { return (void *)out; } else { delete out;