1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-28 13:43:54 +00:00

tweak, compiler optimizes it away anyways though

This commit is contained in:
J. Nick Koston
2025-10-01 20:34:51 +02:00
parent adade2952a
commit a4c794c9fa

View File

@@ -109,9 +109,11 @@ void APIFrameHelper::buffer_data_from_iov_(const struct iovec *iov, int iovcnt,
return;
}
auto buffer = std::make_unique<SendBuffer>();
buffer->size = total_write_len - offset;
buffer->data = std::make_unique<uint8_t[]>(buffer->size);
uint16_t buffer_size = total_write_len - offset;
auto &buffer = this->tx_buf_[this->tx_buf_tail_];
buffer = std::make_unique<SendBuffer>();
buffer->size = buffer_size;
buffer->data = std::make_unique<uint8_t[]>(buffer_size);
uint16_t to_skip = offset;
uint16_t write_pos = 0;
@@ -130,8 +132,7 @@ void APIFrameHelper::buffer_data_from_iov_(const struct iovec *iov, int iovcnt,
}
}
// Add to circular buffer
this->tx_buf_[this->tx_buf_tail_] = std::move(buffer);
// Update circular buffer tracking
this->tx_buf_tail_ = (this->tx_buf_tail_ + 1) % API_MAX_SEND_QUEUE;
this->tx_buf_count_++;
}