Commit 9fe93bb9 authored by Andrey Glebov's avatar Andrey Glebov

- replaced RAPIDJSON_NEW macro with variadic varient

parent 014097e5
...@@ -236,7 +236,7 @@ private: ...@@ -236,7 +236,7 @@ private:
*/ */
bool AddChunk(size_t capacity) { bool AddChunk(size_t capacity) {
if (!baseAllocator_) if (!baseAllocator_)
ownBaseAllocator_ = baseAllocator_ = RAPIDJSON_NEW(BaseAllocator()); ownBaseAllocator_ = baseAllocator_ = RAPIDJSON_NEW(BaseAllocator);
if (ChunkHeader* chunk = reinterpret_cast<ChunkHeader*>(baseAllocator_->Malloc(RAPIDJSON_ALIGN(sizeof(ChunkHeader)) + capacity))) { if (ChunkHeader* chunk = reinterpret_cast<ChunkHeader*>(baseAllocator_->Malloc(RAPIDJSON_ALIGN(sizeof(ChunkHeader)) + capacity))) {
chunk->capacity = capacity; chunk->capacity = capacity;
chunk->size = 0; chunk->size = 0;
......
...@@ -2088,7 +2088,7 @@ public: ...@@ -2088,7 +2088,7 @@ public:
GenericValue<Encoding, Allocator>(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_() GenericValue<Encoding, Allocator>(type), allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{ {
if (!allocator_) if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator);
} }
//! Constructor //! Constructor
...@@ -2101,7 +2101,7 @@ public: ...@@ -2101,7 +2101,7 @@ public:
allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_() allocator_(allocator), ownAllocator_(0), stack_(stackAllocator, stackCapacity), parseResult_()
{ {
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
......
...@@ -606,7 +606,7 @@ public: ...@@ -606,7 +606,7 @@ public:
{ {
RAPIDJSON_ASSERT(regex_.IsValid()); RAPIDJSON_ASSERT(regex_.IsValid());
if (!allocator_) if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator);
stateSet_ = static_cast<unsigned*>(allocator_->Malloc(GetStateSetSize())); stateSet_ = static_cast<unsigned*>(allocator_->Malloc(GetStateSetSize()));
state0_.template Reserve<SizeType>(regex_.stateCount_); state0_.template Reserve<SizeType>(regex_.stateCount_);
state1_.template Reserve<SizeType>(regex_.stateCount_); state1_.template Reserve<SizeType>(regex_.stateCount_);
......
...@@ -183,7 +183,7 @@ private: ...@@ -183,7 +183,7 @@ private:
size_t newCapacity; size_t newCapacity;
if (stack_ == 0) { if (stack_ == 0) {
if (!allocator_) if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator);
newCapacity = initialCapacity_; newCapacity = initialCapacity_;
} else { } else {
newCapacity = GetCapacity(); newCapacity = GetCapacity();
......
...@@ -758,7 +758,7 @@ private: ...@@ -758,7 +758,7 @@ private:
*/ */
Ch* CopyFromRaw(const GenericPointer& rhs, size_t extraToken = 0, size_t extraNameBufferSize = 0) { Ch* CopyFromRaw(const GenericPointer& rhs, size_t extraToken = 0, size_t extraNameBufferSize = 0) {
if (!allocator_) // allocator is independently owned. if (!allocator_) // allocator is independently owned.
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator);
size_t nameBufferSize = rhs.tokenCount_; // null terminators for tokens size_t nameBufferSize = rhs.tokenCount_; // null terminators for tokens
for (Token *t = rhs.tokens_; t != rhs.tokens_ + rhs.tokenCount_; ++t) for (Token *t = rhs.tokens_; t != rhs.tokens_ + rhs.tokenCount_; ++t)
...@@ -806,7 +806,7 @@ private: ...@@ -806,7 +806,7 @@ private:
// Create own allocator if user did not supply. // Create own allocator if user did not supply.
if (!allocator_) if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator);
// Count number of '/' as tokenCount // Count number of '/' as tokenCount
tokenCount_ = 0; tokenCount_ = 0;
......
...@@ -583,7 +583,7 @@ RAPIDJSON_NAMESPACE_END ...@@ -583,7 +583,7 @@ RAPIDJSON_NAMESPACE_END
#ifndef RAPIDJSON_NEW #ifndef RAPIDJSON_NEW
///! customization point for global \c new ///! customization point for global \c new
#define RAPIDJSON_NEW(x) new x #define RAPIDJSON_NEW(type, ...) new type(__VA_ARGS__)
#endif #endif
#ifndef RAPIDJSON_DELETE #ifndef RAPIDJSON_DELETE
///! customization point for global \c delete ///! customization point for global \c delete
......
...@@ -1344,7 +1344,7 @@ public: ...@@ -1344,7 +1344,7 @@ public:
schemaRef_(allocator, kInitialSchemaRefSize) schemaRef_(allocator, kInitialSchemaRefSize)
{ {
if (!allocator_) if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator()); ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator);
typeless_ = static_cast<SchemaType*>(allocator_->Malloc(sizeof(SchemaType))); typeless_ = static_cast<SchemaType*>(allocator_->Malloc(sizeof(SchemaType)));
new (typeless_) SchemaType(this, PointerType(), ValueType(kObjectType).Move(), ValueType(kObjectType).Move(), 0); new (typeless_) SchemaType(this, PointerType(), ValueType(kObjectType).Move(), ValueType(kObjectType).Move(), 0);
...@@ -1823,7 +1823,7 @@ private: ...@@ -1823,7 +1823,7 @@ private:
StateAllocator& GetStateAllocator() { StateAllocator& GetStateAllocator() {
if (!stateAllocator_) if (!stateAllocator_)
stateAllocator_ = ownStateAllocator_ = RAPIDJSON_NEW(StateAllocator()); stateAllocator_ = ownStateAllocator_ = RAPIDJSON_NEW(StateAllocator);
return *stateAllocator_; return *stateAllocator_;
} }
......
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