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