Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit fdff442

Browse files
glebmxzyfer
authored andcommitted
Revert "SharedPtr: More cleanup"
This reverts commit 392ffe1.
1 parent 430315a commit fdff442

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/memory/SharedPtr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ namespace Sass {
6262
// AST_Node_Ptr ast = dynamic_cast<AST_Node*>(node);
6363
if (node->dbg) std::cerr << "DELETE NODE " << node << "\n";
6464
#endif
65-
delete node;
66-
node = NULL;
65+
delete(node);
6766
}
6867
}
6968
}

src/memory/SharedPtr.hpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace Sass {
4848
size_t line;
4949
#endif
5050
static bool taint;
51-
size_t refcounter;
51+
long refcounter;
5252
#ifdef DEBUG_SHARED_PTR
5353
bool dbg;
5454
#endif
@@ -72,9 +72,6 @@ namespace Sass {
7272
void setDbg(bool dbg) {
7373
this->dbg = dbg;
7474
}
75-
size_t getRefCount() const {
76-
return refcounter;
77-
}
7875
#endif
7976
static void setTaint(bool val) {
8077
taint = val;
@@ -83,6 +80,9 @@ namespace Sass {
8380
virtual const std::string to_string() const = 0;
8481

8582
virtual ~SharedObj();
83+
long getRefCount() const {
84+
return refcounter;
85+
}
8686
};
8787

8888

@@ -115,6 +115,9 @@ namespace Sass {
115115
SharedObj* operator-> () const {
116116
return node;
117117
};
118+
bool isNull () {
119+
return node == NULL;
120+
};
118121
bool isNull () const {
119122
return node == NULL;
120123
};
@@ -176,8 +179,6 @@ namespace Sass {
176179

177180
~SharedImpl() {};
178181
public:
179-
using SharedPtr::isNull;
180-
using SharedPtr::operator bool;
181182
operator T*() const {
182183
return static_cast<T*>(this->obj());
183184
}
@@ -196,6 +197,15 @@ namespace Sass {
196197
T* detach() {
197198
return static_cast<T*>(SharedPtr::detach());
198199
}
200+
bool isNull() const {
201+
return this->obj() == NULL;
202+
}
203+
bool operator<(const T& rhs) const {
204+
return *this->ptr() < rhs;
205+
};
206+
operator bool() const {
207+
return this->obj() != NULL;
208+
};
199209
};
200210

201211
}

0 commit comments

Comments
 (0)