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

Commit 7cbe9021 authored by Harry Cutts's avatar Harry Cutts
Browse files

input: use const ref instead of pointer for PropertyMap::addAll

This is already null checked at the only call site.

Bug: 245989146
Test: $ m checkinput
Test: $ atest --host inputflinger_tests
Flag: EXEMPT refactor
Change-Id: Ie77cca4e1f88b63379aaacbaef93d1523b8cd5e7
parent 3dc47145
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public:
    std::optional<double> getDouble(const std::string& key) const;

    /* Adds all values from the specified property map. */
    void addAll(const PropertyMap* map);
    void addAll(const PropertyMap& map);

    /* Loads a property map from a file. */
    static android::base::Result<std::unique_ptr<PropertyMap>> load(const char* filename);
+2 −2
Original line number Diff line number Diff line
@@ -118,8 +118,8 @@ std::optional<double> PropertyMap::getDouble(const std::string& key) const {
    return value;
}

void PropertyMap::addAll(const PropertyMap* map) {
    for (const auto& [key, value] : map->mProperties) {
void PropertyMap::addAll(const PropertyMap& map) {
    for (const auto& [key, value] : map.mProperties) {
        mProperties.emplace(key, value);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -262,7 +262,7 @@ std::list<NotifyArgs> InputDevice::configureInternal(nsecs_t when,
                std::optional<PropertyMap> configuration =
                        getEventHub()->getConfiguration(context.getEventHubId());
                if (configuration) {
                    mConfiguration.addAll(&(*configuration));
                    mConfiguration.addAll(*configuration);
                }
            });