]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
xlist: more assertive
authorSage Weil <sage.weil@dreamhost.com>
Thu, 6 Oct 2011 20:39:33 +0000 (13:39 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Thu, 6 Oct 2011 20:39:33 +0000 (13:39 -0700)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/xlist.h

index 19c90fef5bed34c18bb5466a6715bcfba89d2617..c79ea2b7df8b14b19491123a48b891944bda1ef0 100644 (file)
@@ -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; }