From d9230371ab95ba0dc8e54406729c683d6d29cc39 Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 28 Aug 2007 21:16:27 +0000 Subject: [PATCH] fixed xlist push_back bug git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1714 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/include/xlist.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/trunk/ceph/include/xlist.h b/trunk/ceph/include/xlist.h index b6dc0aec9db25..35099311ef666 100644 --- a/trunk/ceph/include/xlist.h +++ b/trunk/ceph/include/xlist.h @@ -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++; } -- 2.39.5