Invert an if condition
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 13 Feb 2020 11:09:24 +0000 (21:09 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 19 Feb 2020 00:37:46 +0000 (10:37 +1000)
Go from:
  if (a != b)
     continue;
  foo;

to:
  if (a == b) {
      foo;
  }

Basically just an indentation change after the condition inversion, makes the
follow-up patch easier to review.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
libevdev/libevdev.c

index 100c16930e381a805806dc5fbe5858b11e68660a..f8d59da1c060f2d16d5682562e7d1dd70b648d7d 100644 (file)
@@ -740,14 +740,13 @@ terminate_slots(struct libevdev *dev,
        bool touches_stopped = false;
 
        for (int slot = 0; slot < dev->num_slots;  slot++) {
-               if (changes[slot].state != TOUCH_CHANGED)
-                       continue;
-
-               queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
-               queue_push_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
+               if (changes[slot].state == TOUCH_CHANGED) {
+                       queue_push_event(dev, EV_ABS, ABS_MT_SLOT, slot);
+                       queue_push_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
 
-               *last_reported_slot = slot;
-               touches_stopped = true;
+                       *last_reported_slot = slot;
+                       touches_stopped = true;
+               }
        }
 
        /* If any of the touches stopped, we need to split the sync state