From 718121df91764c810dbc0556a3d216c5d849b4ff Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Mon, 5 Jun 2017 09:36:13 +0200 Subject: Remove SharedPtr, it's not used and will be never used, we use C++11 --- src/treegen.cpp | 2 -- src/util/pointer.h | 74 ------------------------------------------------------ 2 files changed, 76 deletions(-) diff --git a/src/treegen.cpp b/src/treegen.cpp index 8bf9619a0..a397bdbd6 100644 --- a/src/treegen.cpp +++ b/src/treegen.cpp @@ -57,7 +57,6 @@ void make_tree(MMVManip &vmanip, v3s16 p0, p1.Y -= 1; VoxelArea leaves_a(v3s16(-2, -1, -2), v3s16(2, 2, 2)); - //SharedPtr leaves_d(new u8[leaves_a.getVolume()]); Buffer leaves_d(leaves_a.getVolume()); for (s32 i = 0; i < leaves_a.getVolume(); i++) leaves_d[i] = 0; @@ -780,7 +779,6 @@ void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed) p1.Y -= 1; VoxelArea leaves_a(v3s16(-3, -6, -3), v3s16(3, 3, 3)); - //SharedPtr leaves_d(new u8[leaves_a.getVolume()]); Buffer leaves_d(leaves_a.getVolume()); for (s32 i = 0; i < leaves_a.getVolume(); i++) leaves_d[i] = 0; diff --git a/src/util/pointer.h b/src/util/pointer.h index 7f6654787..6614ca2c2 100644 --- a/src/util/pointer.h +++ b/src/util/pointer.h @@ -24,80 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "../debug.h" // For assert() #include -template -class SharedPtr -{ -public: - SharedPtr(T *t=NULL) - { - refcount = new int; - *refcount = 1; - ptr = t; - } - SharedPtr(SharedPtr &t) - { - //*this = t; - drop(); - refcount = t.refcount; - (*refcount)++; - ptr = t.ptr; - } - ~SharedPtr() - { - drop(); - } - SharedPtr & operator=(T *t) - { - drop(); - refcount = new int; - *refcount = 1; - ptr = t; - return *this; - } - SharedPtr & operator=(SharedPtr &t) - { - drop(); - refcount = t.refcount; - (*refcount)++; - ptr = t.ptr; - return *this; - } - T* operator->() - { - return ptr; - } - T & operator*() - { - return *ptr; - } - bool operator!=(T *t) - { - return ptr != t; - } - bool operator==(T *t) - { - return ptr == t; - } - T & operator[](unsigned int i) - { - return ptr[i]; - } -private: - void drop() - { - assert((*refcount) > 0); - (*refcount)--; - if(*refcount == 0) - { - delete refcount; - if(ptr != NULL) - delete ptr; - } - } - T *ptr; - int *refcount; -}; - template class Buffer { -- cgit v1.2.3