[PATCH v2 weston 04/17] compositor-drm: Simplify logic in setup_output_seat_constraint

Derek Foreman derekf at osg.samsung.com
Wed Jul 15 11:00:35 PDT 2015


Use early return for a slight simplification.

Reviewed-by: Jonas Ã…dahl <jadahl at gmail.com>
Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
---
 src/compositor-drm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 85eb783..eb661b7 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1965,10 +1965,12 @@ setup_output_seat_constraint(struct drm_backend *b,
 		struct udev_seat *seat;
 
 		seat = udev_seat_get_named(&b->input, s);
-		if (seat)
-			seat->base.output = output;
+		if (!seat)
+			return;
+
+		seat->base.output = output;
 
-		if (seat && seat->base.pointer)
+		if (seat->base.pointer)
 			weston_pointer_clamp(seat->base.pointer,
 					     &seat->base.pointer->x,
 					     &seat->base.pointer->y);
-- 
2.1.4



More information about the wayland-devel mailing list