MCPcopy Create free account
hub / github.com/audeering/opensmile / Expand

Method Expand

src/include/rapidjson/internal/stack.h:182–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180private:
181 template<typename T>
182 void Expand(size_t count) {
183 // Only expand the capacity if the current stack exists. Otherwise just create a stack with initial capacity.
184 size_t newCapacity;
185 if (stack_ == 0) {
186 if (!allocator_)
187 ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
188 newCapacity = initialCapacity_;
189 } else {
190 newCapacity = GetCapacity();
191 newCapacity += (newCapacity + 1) / 2;
192 }
193 size_t newSize = GetSize() + sizeof(T) * count;
194 if (newCapacity < newSize)
195 newCapacity = newSize;
196
197 Resize(newCapacity);
198 }
199
200 void Resize(size_t newCapacity) {
201 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