| 111 | void Clear() { stackTop_ = stack_; } |
| 112 | |
| 113 | void ShrinkToFit() { |
| 114 | if (Empty()) { |
| 115 | // If the stack is empty, completely deallocate the memory. |
| 116 | Allocator::Free(stack_); // NOLINT (+clang-analyzer-unix.Malloc) |
| 117 | stack_ = 0; |
| 118 | stackTop_ = 0; |
| 119 | stackEnd_ = 0; |
| 120 | } |
| 121 | else |
| 122 | Resize(GetSize()); |
| 123 | } |
| 124 | |
| 125 | // Optimization note: try to minimize the size of this function for force inline. |
| 126 | // Expansion is run very infrequently, so it is moved to another (probably non-inline) function. |
no test coverage detected