From 9df835600cae95c6d6a6d5284f7a9efc157adec5 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 29 Mar 2026 11:26:23 -1000 Subject: [PATCH] [api] Rename write_raw_inline_ to write_raw_fast_ --- esphome/components/api/api_frame_helper.h | 5 ++--- esphome/components/api/api_frame_helper_noise.cpp | 4 ++-- esphome/components/api/api_frame_helper_plaintext.cpp | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/esphome/components/api/api_frame_helper.h b/esphome/components/api/api_frame_helper.h index 4b64c50925d..f8f9bf81ef2 100644 --- a/esphome/components/api/api_frame_helper.h +++ b/esphome/components/api/api_frame_helper.h @@ -193,7 +193,7 @@ class APIFrameHelper { // Inlined write methods — used by hot paths (write_protobuf_packet, write_protobuf_messages) // These inline the fast path (overflow empty + full write) and tail-call the out-of-line // slow path only on failure/partial write. - inline APIError ESPHOME_ALWAYS_INLINE write_raw_inline_(const void *data, uint16_t len) { + inline APIError ESPHOME_ALWAYS_INLINE write_raw_fast_(const void *data, uint16_t len) { ssize_t sent = -1; if (this->overflow_buf_.empty()) [[likely]] { sent = this->socket_->write(data, len); @@ -202,8 +202,7 @@ class APIFrameHelper { } return this->write_raw_slow_(data, len, sent); } - inline APIError ESPHOME_ALWAYS_INLINE write_raw_inline_(const struct iovec *iov, int iovcnt, - uint16_t total_write_len) { + inline APIError ESPHOME_ALWAYS_INLINE write_raw_fast_(const struct iovec *iov, int iovcnt, uint16_t total_write_len) { ssize_t sent = -1; if (this->overflow_buf_.empty()) [[likely]] { sent = this->socket_->writev(iov, iovcnt); diff --git a/esphome/components/api/api_frame_helper_noise.cpp b/esphome/components/api/api_frame_helper_noise.cpp index 190d0711a8e..4b8b2f97069 100644 --- a/esphome/components/api/api_frame_helper_noise.cpp +++ b/esphome/components/api/api_frame_helper_noise.cpp @@ -504,7 +504,7 @@ APIError APINoiseFrameHelper::write_protobuf_packet(uint8_t type, ProtoWriteBuff aerr = this->encrypt_noise_message_(buf_start, msg, iov); if (aerr != APIError::OK) return aerr; - return this->write_raw_inline_(iov.iov_base, static_cast(iov.iov_len)); + return this->write_raw_fast_(iov.iov_base, static_cast(iov.iov_len)); } APIError APINoiseFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffer, std::span messages) { @@ -530,7 +530,7 @@ APIError APINoiseFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffer, s total_write_len += iov.iov_len; } - return this->write_raw_inline_(iovs.data(), iovs.size(), total_write_len); + return this->write_raw_fast_(iovs.data(), iovs.size(), total_write_len); } APIError APINoiseFrameHelper::write_frame_(const uint8_t *data, uint16_t len) { diff --git a/esphome/components/api/api_frame_helper_plaintext.cpp b/esphome/components/api/api_frame_helper_plaintext.cpp index 6bd4b20a3bb..cb97f9d3942 100644 --- a/esphome/components/api/api_frame_helper_plaintext.cpp +++ b/esphome/components/api/api_frame_helper_plaintext.cpp @@ -292,7 +292,7 @@ APIError APIPlaintextFrameHelper::write_protobuf_packet(uint8_t type, ProtoWrite uint8_t *msg_start = write_plaintext_header(buffer_data, msg, frame_header_padding_); uint8_t msg_header_len = static_cast(buffer_data + frame_header_padding_ - msg_start); uint16_t msg_len = static_cast(msg_header_len + msg.payload_size); - return this->write_raw_inline_(msg_start, msg_len); + return this->write_raw_fast_(msg_start, msg_len); } APIError APIPlaintextFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffer, @@ -318,7 +318,7 @@ APIError APIPlaintextFrameHelper::write_protobuf_messages(ProtoWriteBuffer buffe total_write_len += msg_len; } - return this->write_raw_inline_(iovs.data(), iovs.size(), total_write_len); + return this->write_raw_fast_(iovs.data(), iovs.size(), total_write_len); } } // namespace esphome::api