ESPHome 2026.3.0
Loading...
Searching...
No Matches
api_buffer.cpp
Go to the documentation of this file.
1#include "api_buffer.h"
2
3namespace esphome::api {
4
5void APIBuffer::grow_(size_t n) {
6 auto new_data = make_buffer(n);
7 if (this->size_)
8 std::memcpy(new_data.get(), this->data_.get(), this->size_);
9 this->data_ = std::move(new_data);
10 this->capacity_ = n;
11}
12
13} // namespace esphome::api
void grow_(size_t n)
Definition api_buffer.cpp:5
std::unique_ptr< uint8_t[]> data_
Definition api_buffer.h:62
std::unique_ptr< uint8_t[]> make_buffer(size_t n)
Helper to use make_unique_for_overwrite where available (skips zero-fill), falling back to make_uniqu...
Definition api_buffer.h:14