Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4df10563 authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

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
parent 02ccdc5d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class BatteryPropertiesRegistrar : public BnBatteryPropertiesRegistrar,
                                   public IBinder::DeathRecipient {
public:
    void publish(const sp<BatteryPropertiesRegistrar>& service);
    void notifyListeners(struct BatteryProperties props);
    void notifyListeners(const struct BatteryProperties& props);

private:
    Mutex mRegistrationLock;