| 915 | } |
| 916 | |
| 917 | Status Reserve(const int64_t capacity) override { |
| 918 | if (capacity < 0) { |
| 919 | return Status::Invalid("Negative buffer capacity: ", capacity); |
| 920 | } |
| 921 | uint8_t* ptr = mutable_data(); |
| 922 | if (!ptr || capacity > capacity_) { |
| 923 | ARROW_ASSIGN_OR_RAISE(int64_t new_capacity, RoundCapacity(capacity)); |
| 924 | if (ptr) { |
| 925 | RETURN_NOT_OK(pool_->Reallocate(capacity_, new_capacity, alignment_, &ptr)); |
| 926 | } else { |
| 927 | RETURN_NOT_OK(pool_->Allocate(new_capacity, alignment_, &ptr)); |
| 928 | } |
| 929 | data_ = ptr; |
| 930 | capacity_ = new_capacity; |
| 931 | } |
| 932 | return Status::OK(); |
| 933 | } |
| 934 | |
| 935 | Status Resize(const int64_t new_size, bool shrink_to_fit = true) override { |
| 936 | if (ARROW_PREDICT_FALSE(new_size < 0)) { |
nothing calls this directly
no test coverage detected