From 0add10986dc986a12248f9b41cf55142ddcc8df9 Mon Sep 17 00:00:00 2001 From: Taehyeon Jeong Date: Fri, 13 Jun 2025 22:56:40 +0900 Subject: [PATCH] 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 --- libweston/input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libweston/input.c b/libweston/input.c index e4c51a6a7..946c265f2 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -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;