mirror of
https://github.com/esphome/esphome.git
synced 2025-10-22 11:43:51 +01:00
Implement zero-copy API for zwave_proxy (#10836)
Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
This commit is contained in:
@@ -3035,12 +3035,9 @@ bool UpdateCommandRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
|
||||
bool ZWaveProxyFrame::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
|
||||
switch (field_id) {
|
||||
case 1: {
|
||||
const std::string &data_str = value.as_string();
|
||||
this->data_len = data_str.size();
|
||||
if (this->data_len > 257) {
|
||||
this->data_len = 257;
|
||||
}
|
||||
memcpy(this->data, data_str.data(), this->data_len);
|
||||
// Use raw data directly to avoid allocation
|
||||
this->data = value.data();
|
||||
this->data_len = value.size();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user