From: Sage Weil Date: Thu, 6 Oct 2011 20:39:33 +0000 (-0700) Subject: xlist: more assertive X-Git-Tag: v0.37~54 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=646ef6aaac1bfbe88a17fde31caf9aff9ff66af9;p=ceph.git xlist: more assertive Signed-off-by: Sage Weil --- diff --git a/src/include/xlist.h b/src/include/xlist.h index 19c90fef5bed..c79ea2b7df8b 100644 --- a/src/include/xlist.h +++ b/src/include/xlist.h @@ -69,14 +69,19 @@ public: assert(_back == 0); } - int size() const { return _size; } + int size() const { + assert((bool)_front == (bool)_size); + return _size; + } bool empty() const { assert((bool)_front == (bool)_size); return _front == 0; } void clear() { - while (_front) remove(_front); + while (_front) + remove(_front); + assert((bool)_front == (bool)_size); } void push_front(item *i) { @@ -122,6 +127,7 @@ public: i->_list = 0; i->_next = i->_prev = 0; + assert((bool)_front == (bool)_size); } T front() { return (T)_front->_item; }