From: Matan Breizman Date: Thu, 18 Aug 2022 12:35:28 +0000 (+0000) Subject: include/buffer: avoid it = it->next() usage X-Git-Tag: v18.0.0~194^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47672%2Fhead;p=ceph.git include/buffer: avoid it = it->next() usage Signed-off-by: Matan Breizman --- diff --git a/src/include/buffer.h b/src/include/buffer.h index fdbaae83659..19fcfc29fb4 100644 --- a/src/include/buffer.h +++ b/src/include/buffer.h @@ -594,13 +594,13 @@ struct error_code; } } void clear_and_dispose() { - for (auto it = begin(); it != end(); /* nop */) { - auto& node = *it; - it = it->next; - ptr_node::disposer()(&node); + ptr_node::disposer dispose; + for (auto it = begin(), e = end(); it != e; /* nop */) { + auto& node = *it++; + dispose(&node); } - _root.next = &_root; _tail = &_root; + _root.next = _tail; } iterator erase_after_and_dispose(iterator it) { auto* to_dispose = &*std::next(it);