From 86bfedc30e6ca55c2e07bc1c9a4f51d0e4da4e69 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 1 Oct 2025 23:30:33 +0200 Subject: [PATCH] preen --- esphome/components/mdns/mdns_component.cpp | 2 -- esphome/components/mdns/mdns_component.h | 4 ++-- esphome/components/openthread/openthread.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/esphome/components/mdns/mdns_component.cpp b/esphome/components/mdns/mdns_component.cpp index eb9a355d40..e22bba16f6 100644 --- a/esphome/components/mdns/mdns_component.cpp +++ b/esphome/components/mdns/mdns_component.cpp @@ -200,8 +200,6 @@ void MDNSComponent::dump_config() { #endif } -StaticVector MDNSComponent::get_services() { return this->services_; } - } // namespace mdns } // namespace esphome #endif diff --git a/esphome/components/mdns/mdns_component.h b/esphome/components/mdns/mdns_component.h index 4e1320c0e5..9193aaaf31 100644 --- a/esphome/components/mdns/mdns_component.h +++ b/esphome/components/mdns/mdns_component.h @@ -39,10 +39,10 @@ class MDNSComponent : public Component { float get_setup_priority() const override { return setup_priority::AFTER_CONNECTION; } #ifdef USE_MDNS_EXTRA_SERVICES - void add_extra_service(MDNSService service) { services_.push_back(std::move(service)); } + void add_extra_service(MDNSService service) { this->services_.push_back(std::move(service)); } #endif - StaticVector get_services(); + const StaticVector &get_services() const { return this->services_; } void on_shutdown() override; diff --git a/esphome/components/openthread/openthread.cpp b/esphome/components/openthread/openthread.cpp index 698688b425..57b972d195 100644 --- a/esphome/components/openthread/openthread.cpp +++ b/esphome/components/openthread/openthread.cpp @@ -144,7 +144,7 @@ void OpenThreadSrpComponent::setup() { } // Get mdns services and copy their data (strings are copied with strdup below) - auto mdns_services = this->mdns_->get_services(); + const auto &mdns_services = this->mdns_->get_services(); ESP_LOGD(TAG, "Setting up SRP services. count = %d\n", mdns_services.size()); for (const auto &service : mdns_services) { otSrpClientBuffersServiceEntry *entry = otSrpClientBuffersAllocateService(instance);