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

Commit 3cec4466 authored by Michael Wright's avatar Michael Wright
Browse files

Fix for-loop type in dumpDispatchStateLocked

Technically the iterator provides a std::pair<const KEY, VALUE>&, so
we're constructing a std::pair<KEY, VALUE> from it and then taking a
const reference to that. This creates an unnecessary copy but then
obscures that by taking a reference to it. We could use the correct type
to avoid this, but a structured binding is even nicer.

Test: compile
Change-Id: I360c4318001eff503b539693166386160bd605eb
parent ebd913b1
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -5435,9 +5435,7 @@ void InputDispatcher::dumpDispatchStateLocked(std::string& dump) {

    if (!mReplacedKeys.empty()) {
        dump += INDENT "ReplacedKeys:\n";
        for (const std::pair<KeyReplacement, int32_t>& pair : mReplacedKeys) {
            const KeyReplacement& replacement = pair.first;
            int32_t newKeyCode = pair.second;
        for (const auto& [replacement, newKeyCode] : mReplacedKeys) {
            dump += StringPrintf(INDENT2 "originalKeyCode=%d, deviceId=%d -> newKeyCode=%d\n",
                                 replacement.keyCode, replacement.deviceId, newKeyCode);
        }