MCPcopy Create free account
hub / github.com/cinience/RedisStudio / Expand

Method Expand

include/rapidjson/internal/stack.h:138–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136private:
137 template<typename T>
138 void Expand(size_t count) {
139 // Only expand the capacity if the current stack exists. Otherwise just create a stack with initial capacity.
140 size_t newCapacity;
141 if (stack_ == 0) {
142 if (!allocator_)
143 ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator());
144 newCapacity = initialCapacity_;
145 } else {
146 newCapacity = GetCapacity();
147 newCapacity += (newCapacity + 1) / 2;
148 }
149 size_t newSize = GetSize() + sizeof(T) * count;
150 if (newCapacity < newSize)
151 newCapacity = newSize;
152
153 Resize(newCapacity);
154 }
155
156 void Resize(size_t newCapacity) {
157 const size_t size = GetSize(); // Backup the current size

Callers

nothing calls this directly

Calls 1

GetSizeFunction · 0.50

Tested by

no test coverage detected