[api] Replace std::vector<uint8_t> with APIBuffer to skip zero-fill (#14593)

This commit is contained in:
J. Nick Koston
2026-03-10 09:11:12 -10:00
committed by GitHub
parent 6e468936ec
commit c709010c4c
11 changed files with 107 additions and 30 deletions
+13
View File
@@ -0,0 +1,13 @@
#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