From 4e244f2ae52637325618cda091cafe94acb2cc67 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 21 Jun 2011 09:05:15 -0700 Subject: [PATCH] [dex]list: not copyable The list items are embedded in other structures; copying the list will lead to duplicated references and other badness. Signed-off-by: Sage Weil --- src/include/dlist.h | 4 ++++ src/include/elist.h | 4 ++++ src/include/xlist.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/include/dlist.h b/src/include/dlist.h index e7b938c14d215..09eb0bc151241 100644 --- a/src/include/dlist.h +++ b/src/include/dlist.h @@ -26,6 +26,7 @@ public: ~item() { assert(!is_on_list()); } + // no copying! item(const item& other); const item& operator= (const item& right); @@ -65,6 +66,9 @@ private: item _head; public: + dlist(const dlist& other); + const dlist& operator=(const dlist& other); + dlist() : _head(NULL) {} ~dlist() { assert(_head.empty()); diff --git a/src/include/elist.h b/src/include/elist.h index 3130fb36af7c7..03ed0f33b5b51 100644 --- a/src/include/elist.h +++ b/src/include/elist.h @@ -38,6 +38,7 @@ public: ~item() { assert(!is_on_list()); } + // no copying! item(const item& other); const item& operator= (const item& right); @@ -83,6 +84,9 @@ private: size_t item_offset; public: + elist(const elist& other); + const elist& operator=(const elist& other); + elist(size_t o) : _head(NULL), item_offset(o) {} ~elist() { assert(_head.empty()); diff --git a/src/include/xlist.h b/src/include/xlist.h index 4a4ffae160d2f..19c90fef5bed3 100644 --- a/src/include/xlist.h +++ b/src/include/xlist.h @@ -28,6 +28,7 @@ public: assert(!is_on_list()); //remove_myself(); } + // no copying! item(const item& other); const item& operator= (const item& right); @@ -58,6 +59,9 @@ private: int _size; public: + xlist(const xlist& other); + const xlist& operator=(const xlist& other); + xlist() : _front(0), _back(0), _size(0) {} ~xlist() { assert(_size == 0); -- 2.39.5