| 122 | } |
| 123 | |
| 124 | void *Realloc(void *p, SQUnsignedInteger oldsize, SQUnsignedInteger size) |
| 125 | { |
| 126 | if (p == nullptr) { |
| 127 | return this->Malloc(size); |
| 128 | } |
| 129 | if (size == 0) { |
| 130 | this->Free(p, oldsize); |
| 131 | return nullptr; |
| 132 | } |
| 133 | |
| 134 | this->CheckAllocationAllowed(size - oldsize); |
| 135 | |
| 136 | void *new_p = this->DoAlloc(size); |
| 137 | std::copy_n(static_cast<std::byte *>(p), std::min(oldsize, size), static_cast<std::byte *>(new_p)); |
| 138 | this->Free(p, oldsize); |
| 139 | |
| 140 | return new_p; |
| 141 | } |
| 142 | |
| 143 | void Free(void *p, SQUnsignedInteger size) |
| 144 | { |
no test coverage detected