From 4df105635b626a894f16eaec92e763b773a5a6e1 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 27 Jul 2016 16:05:50 -0700 Subject: [PATCH] Fix clang-tidy performance warnings in healthd. * Use const reference type for parameters to avoid unnecessary copy. Bug: 30407689 Change-Id: I926ea7b6e9e020a228c812b7e23087a2b7ed9809 Test: build with WITH_TIDY=1 --- healthd/BatteryPropertiesRegistrar.cpp | 2 +- healthd/BatteryPropertiesRegistrar.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/healthd/BatteryPropertiesRegistrar.cpp b/healthd/BatteryPropertiesRegistrar.cpp index 5d1fa52b1..d28ba41ff 100644 --- a/healthd/BatteryPropertiesRegistrar.cpp +++ b/healthd/BatteryPropertiesRegistrar.cpp @@ -35,7 +35,7 @@ void BatteryPropertiesRegistrar::publish( defaultServiceManager()->addService(String16("batteryproperties"), service); } -void BatteryPropertiesRegistrar::notifyListeners(struct BatteryProperties props) { +void BatteryPropertiesRegistrar::notifyListeners(const struct BatteryProperties& props) { Mutex::Autolock _l(mRegistrationLock); for (size_t i = 0; i < mListeners.size(); i++) { mListeners[i]->batteryPropertiesChanged(props); diff --git a/healthd/BatteryPropertiesRegistrar.h b/healthd/BatteryPropertiesRegistrar.h index d17e4a327..095f3d37c 100644 --- a/healthd/BatteryPropertiesRegistrar.h +++ b/healthd/BatteryPropertiesRegistrar.h @@ -31,7 +31,7 @@ class BatteryPropertiesRegistrar : public BnBatteryPropertiesRegistrar, public IBinder::DeathRecipient { public: void publish(const sp& service); - void notifyListeners(struct BatteryProperties props); + void notifyListeners(const struct BatteryProperties& props); private: Mutex mRegistrationLock;