item(T i=0) : _prev(this), _next(this) {}
~item() {
- assert(!is_on_list());
+ ceph_assert(!is_on_list());
}
- // no copying!
- item(const item& other);
- const item& operator= (const item& right);
+ item(const item& other) = delete;
+ const item& operator= (const item& right) = delete;
bool empty() const { return _prev == this; }
bool remove_myself() {
if (_next == this) {
- assert(_prev == this);
+ ceph_assert(_prev == this);
return false;
}
_next->_prev = _prev;
}
void insert_after(item *other) {
- assert(other->empty());
+ ceph_assert(other->empty());
other->_prev = this;
other->_next = _next;
_next->_prev = other;
_next = other;
}
void insert_before(item *other) {
- assert(other->empty());
+ ceph_assert(other->empty());
other->_next = this;
other->_prev = _prev;
_prev->_next = other;
}
T get_item(size_t offset) {
- assert(offset);
+ ceph_assert(offset);
return (T)(((char *)this) - offset);
}
};
elist(size_t o) : _head(NULL), item_offset(o) {}
~elist() {
- assert(_head.empty());
+ ceph_assert(_head.empty());
}
bool empty() const {
}
T front(size_t o=0) {
- assert(!_head.empty());
+ ceph_assert(!_head.empty());
return _head._next->get_item(o ? o : item_offset);
}
T back(size_t o=0) {
- assert(!_head.empty());
+ ceph_assert(!_head.empty());
return _head._prev->get_item(o ? o : item_offset);
}
void pop_front() {
- assert(!empty());
+ ceph_assert(!empty());
_head._next->remove_myself();
}
void pop_back() {
- assert(!empty());
+ ceph_assert(!empty());
_head._prev->remove_myself();
}
iterator(item *h, size_t o, mode_t m) :
head(h), cur(h->_next), next(cur->_next), item_offset(o),
mode(m) {
- assert(item_offset > 0);
+ ceph_assert(item_offset > 0);
}
T operator*() {
return cur->get_item(item_offset);
}
iterator& operator++() {
- assert(cur);
- assert(cur != head);
+ ceph_assert(cur);
+ ceph_assert(cur != head);
if (mode == MAGIC) {
// if 'cur' appears to be valid, use that. otherwise,
// use cached 'next'.