Files
esphome/esphome/components/api/api_buffer.cpp
T
J. Nick Koston 126f695b93 [api] Extract APIBuffer to own file, use for rx_buf_ and prologue_
- Move APIBuffer (renamed from ProtoByteBuffer) to api_buffer.h/cpp
- Use APIBuffer for rx_buf_ (frame helper receive buffer) and
  prologue_ (noise handshake buffer) to skip zero-fill on resize
- Remove dead write_raw_ template overload and unused <vector> include
2026-03-07 19:41:05 -10:00

14 lines
295 B
C++

#include "api_buffer.h"
namespace esphome::api {
void APIBuffer::grow_(size_t n) {
auto new_data = make_buffer(n);
if (this->size_)
std::memcpy(new_data.get(), this->data_.get(), this->size_);
this->data_ = std::move(new_data);
this->capacity_ = n;
}
} // namespace esphome::api