| 18 | } |
| 19 | |
| 20 | char* reserve(size_t capacity) { |
| 21 | if (node_ && capacity > node_->length) { |
| 22 | // existing buffer is too small, we need to reallocate |
| 23 | resources_->destroyString(node_); |
| 24 | node_ = nullptr; |
| 25 | } |
| 26 | if (!node_) |
| 27 | node_ = resources_->createString(capacity); |
| 28 | if (!node_) |
| 29 | return nullptr; |
| 30 | size_ = capacity; |
| 31 | node_->data[capacity] = 0; // null-terminate the string |
| 32 | return node_->data; |
| 33 | } |
| 34 | |
| 35 | JsonString str() const { |
| 36 | ARDUINOJSON_ASSERT(node_ != nullptr); |
nothing calls this directly
no test coverage detected