Commit d0c28325 authored by Philipp A. Hartmann's avatar Philipp A. Hartmann

Stack<>: add _ suffix to member ownAllocator_

For consistency, all member variables should follow the same pattern.
parent 4fa43bd4
...@@ -35,23 +35,23 @@ class Stack { ...@@ -35,23 +35,23 @@ class Stack {
public: public:
// Optimization note: Do not allocate memory for stack_ in constructor. // Optimization note: Do not allocate memory for stack_ in constructor.
// Do it lazily when first Push() -> Expand() -> Resize(). // Do it lazily when first Push() -> Expand() -> Resize().
Stack(Allocator* allocator, size_t stackCapacity) : allocator_(allocator), ownAllocator(0), stack_(0), stackTop_(0), stackEnd_(0), initialCapacity_(stackCapacity) { Stack(Allocator* allocator, size_t stackCapacity) : allocator_(allocator), ownAllocator_(0), stack_(0), stackTop_(0), stackEnd_(0), initialCapacity_(stackCapacity) {
RAPIDJSON_ASSERT(stackCapacity > 0); RAPIDJSON_ASSERT(stackCapacity > 0);
if (!allocator_) if (!allocator_)
ownAllocator = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator());
} }
#if RAPIDJSON_HAS_CXX11_RVALUE_REFS #if RAPIDJSON_HAS_CXX11_RVALUE_REFS
Stack(Stack&& rhs) Stack(Stack&& rhs)
: allocator_(rhs.allocator_), : allocator_(rhs.allocator_),
ownAllocator(rhs.ownAllocator), ownAllocator_(rhs.ownAllocator_),
stack_(rhs.stack_), stack_(rhs.stack_),
stackTop_(rhs.stackTop_), stackTop_(rhs.stackTop_),
stackEnd_(rhs.stackEnd_), stackEnd_(rhs.stackEnd_),
initialCapacity_(rhs.initialCapacity_) initialCapacity_(rhs.initialCapacity_)
{ {
rhs.allocator_ = 0; rhs.allocator_ = 0;
rhs.ownAllocator = 0; rhs.ownAllocator_ = 0;
rhs.stack_ = 0; rhs.stack_ = 0;
rhs.stackTop_ = 0; rhs.stackTop_ = 0;
rhs.stackEnd_ = 0; rhs.stackEnd_ = 0;
...@@ -70,14 +70,14 @@ public: ...@@ -70,14 +70,14 @@ public:
Destroy(); Destroy();
allocator_ = rhs.allocator_; allocator_ = rhs.allocator_;
ownAllocator = rhs.ownAllocator; ownAllocator_ = rhs.ownAllocator_;
stack_ = rhs.stack_; stack_ = rhs.stack_;
stackTop_ = rhs.stackTop_; stackTop_ = rhs.stackTop_;
stackEnd_ = rhs.stackEnd_; stackEnd_ = rhs.stackEnd_;
initialCapacity_ = rhs.initialCapacity_; initialCapacity_ = rhs.initialCapacity_;
rhs.allocator_ = 0; rhs.allocator_ = 0;
rhs.ownAllocator = 0; rhs.ownAllocator_ = 0;
rhs.stack_ = 0; rhs.stack_ = 0;
rhs.stackTop_ = 0; rhs.stackTop_ = 0;
rhs.stackEnd_ = 0; rhs.stackEnd_ = 0;
...@@ -162,7 +162,7 @@ private: ...@@ -162,7 +162,7 @@ private:
void Destroy() { void Destroy() {
Allocator::Free(stack_); Allocator::Free(stack_);
RAPIDJSON_DELETE(ownAllocator); // Only delete if it is owned by the stack RAPIDJSON_DELETE(ownAllocator_); // Only delete if it is owned by the stack
} }
// Prohibit copy constructor & assignment operator. // Prohibit copy constructor & assignment operator.
...@@ -170,7 +170,7 @@ private: ...@@ -170,7 +170,7 @@ private:
Stack& operator=(const Stack&); Stack& operator=(const Stack&);
Allocator* allocator_; Allocator* allocator_;
Allocator* ownAllocator; Allocator* ownAllocator_;
char *stack_; char *stack_;
char *stackTop_; char *stackTop_;
char *stackEnd_; char *stackEnd_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment