From 1b5ad59da5df28a7b8eaa3109c7cf4428db0e187 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 1 Oct 2025 15:57:16 +0200 Subject: [PATCH] [api] Reduce flash usage in user services by eliminating vector copy --- esphome/components/api/user_services.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/esphome/components/api/user_services.h b/esphome/components/api/user_services.h index 5f040e8433..170a2f7090 100644 --- a/esphome/components/api/user_services.h +++ b/esphome/components/api/user_services.h @@ -25,8 +25,8 @@ template enums::ServiceArgType to_service_arg_type(); template class UserServiceBase : public UserServiceDescriptor { public: - UserServiceBase(std::string name, const std::array &arg_names) - : name_(std::move(name)), arg_names_(arg_names) { + UserServiceBase(const std::string &name, const std::array &arg_names) + : name_(name), arg_names_(arg_names) { this->key_ = fnv1_hash(this->name_); } @@ -55,7 +55,7 @@ template class UserServiceBase : public UserServiceDescriptor { protected: virtual void execute(Ts... x) = 0; - template void execute_(std::vector args, seq type) { + template void execute_(const std::vector &args, seq type) { this->execute((get_execute_arg_value(args[S]))...); }