From 25c3c79809a61b3677e9ae8e0d7a00ae20f5d7b2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 22 Feb 2026 22:47:19 -0600 Subject: [PATCH] Rename next_index_ to next_index for static method naming convention Static methods should not have trailing underscore per clang-tidy readability-identifier-naming rules. --- esphome/core/lock_free_queue.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/core/lock_free_queue.h b/esphome/core/lock_free_queue.h index a589087162..522fbd36e1 100644 --- a/esphome/core/lock_free_queue.h +++ b/esphome/core/lock_free_queue.h @@ -41,7 +41,7 @@ template class LockFreeQueue { // Advance ring buffer index by one, wrapping at SIZE. // Power-of-2 sizes use modulo (compiler emits single mask instruction). // Non-power-of-2 sizes use comparison to avoid expensive multiply-shift sequences. - static constexpr uint8_t next_index_(uint8_t index) { + static constexpr uint8_t next_index(uint8_t index) { if constexpr ((SIZE & (SIZE - 1)) == 0) { return (index + 1) % SIZE; } else { @@ -58,7 +58,7 @@ template class LockFreeQueue { return false; uint8_t current_tail = tail_.load(std::memory_order_relaxed); - uint8_t next_tail = next_index_(current_tail); + uint8_t next_tail = next_index(current_tail); // Read head before incrementing tail uint8_t head_before = head_.load(std::memory_order_acquire); @@ -87,7 +87,7 @@ template class LockFreeQueue { } T *element = buffer_[current_head]; - head_.store(next_index_(current_head), std::memory_order_release); + head_.store(next_index(current_head), std::memory_order_release); return element; } @@ -111,7 +111,7 @@ template class LockFreeQueue { bool empty() const { return head_.load(std::memory_order_acquire) == tail_.load(std::memory_order_acquire); } bool full() const { - uint8_t next_tail = next_index_(tail_.load(std::memory_order_relaxed)); + uint8_t next_tail = next_index(tail_.load(std::memory_order_relaxed)); return next_tail == head_.load(std::memory_order_acquire); }