Allocates a memory block. (concept Allocator)
| 166 | |
| 167 | //! Allocates a memory block. (concept Allocator) |
| 168 | void* Malloc(size_t size) { |
| 169 | size = RAPIDJSON_ALIGN(size); |
| 170 | if (chunkHead_ == 0 || chunkHead_->size + size > chunkHead_->capacity) |
| 171 | AddChunk(chunk_capacity_ > size ? chunk_capacity_ : size); |
| 172 | |
| 173 | void *buffer = reinterpret_cast<char *>(chunkHead_ + 1) + chunkHead_->size; |
| 174 | chunkHead_->size += size; |
| 175 | return buffer; |
| 176 | } |
| 177 | |
| 178 | //! Resizes a memory block (concept Allocator) |
| 179 | void* Realloc(void* originalPtr, size_t originalSize, size_t newSize) { |
no outgoing calls
no test coverage detected