Rewrite
  foo(); while(...) { foo(); }
into
  do { foo(); } while(...);
to avoid duplication and make the flow easier to read and understand.

Signed-off-by: Eric Engestrom <[email protected]>
---
 src/libinput.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/libinput.c b/src/libinput.c
index 472b1c0..e84e3c3 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -54,15 +54,15 @@ check_event_type(struct libinput *libinput,
        unsigned int type_permitted;
 
        va_start(args, type_in);
-       type_permitted = va_arg(args, unsigned int);
 
-       while (type_permitted != (unsigned int)-1) {
+       do {
+               type_permitted = va_arg(args, unsigned int);
+
                if (type_permitted == type_in) {
                        rc = true;
                        break;
                }
-               type_permitted = va_arg(args, unsigned int);
-       }
+       } while (type_permitted != (unsigned int)-1);
 
        va_end(args);
 
-- 
Cheers,
  Eric

_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to