mirror of
https://github.com/esphome/esphome.git
synced 2026-09-12 07:47:33 +00:00
[api] Replace std::vector<uint8_t> with APIBuffer to skip zero-fill (#14593)
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user