input: improve keyboard keys array traversal in notify_key()

The loop in notify_key() that traverses the keyboard keys array has been
improved by adding a break statement after removing a key and simplifying
the loop structure. This eliminates unnecessary iterations and removes
ambiguity in the code flow, making it both more efficient and clearer.

Signed-off-by: Taehyeon Jeong wxogus25@gmail.com
This commit is contained in:
Taehyeon Jeong 2025-06-13 22:56:40 +09:00 committed by Marius Vlad
parent 37bf61c68c
commit 0add10986d

View file

@ -2685,6 +2685,7 @@ notify_key(struct weston_seat *seat, const struct timespec *time, uint32_t key,
if (state == WL_KEYBOARD_KEY_STATE_PRESSED)
return;
*k = *--end;
break;
}
}
keyboard->keys.size = (void *) end - keyboard->keys.data;