]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fixed xlist push_back bug
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 28 Aug 2007 21:16:27 +0000 (21:16 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 28 Aug 2007 21:16:27 +0000 (21:16 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1714 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/include/xlist.h

index b6dc0aec9db2503ac0808b19b69a7561376e7c1a..35099311ef6661506cd25c17926cb45c5d64342a 100644 (file)
@@ -41,7 +41,10 @@ public:
   xlist() : _front(0), _back(0), _size(0) {}
 
   int size() { return _size; }
-  bool empty() { return _front == 0; }
+  bool empty() { 
+    assert((bool)_front == (bool)_size);
+    return _front == 0; 
+  }
 
   void clear() {
     while (_front) remove(_front);
@@ -54,7 +57,10 @@ public:
     item->_head = this;
     item->_next = 0;
     item->_prev = _back;
-    if (_back) _back->_next = item;
+    if (_back) 
+      _back->_next = item;
+    else
+      _front = item;
     _back = item;
     _size++;
   }