From 3d24fae3ad1c59f7baa6dd90dd53bda39dbddf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Thu, 1 Dec 2016 22:12:29 +0100 Subject: Tighten screen sorting: comparing a screen with itself should return 0 --- src/screen.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'src/screen.c') diff --git a/src/screen.c b/src/screen.c index 7593f49..9c7f1e6 100644 --- a/src/screen.c +++ b/src/screen.c @@ -204,20 +204,14 @@ screen_cmp (void *priv, struct list_head *a, struct list_head *b) rp_screen *sc_b = container_of (b, typeof(*sc_b), node); if (sc_a->left < sc_b->left) - { - return -1; - } - else if (sc_a->left > sc_b->left) - { - return 1; - } - else if (sc_a->left == sc_b->left) - { - if (sc_a->top < sc_b->top) - return -1; - else - return 1; - } + return -1; + if (sc_a->left > sc_b->left) + return 1; + + if (sc_a->top > sc_b->top) + return -1; + if (sc_a->top < sc_b->top) + return 1; return 0; } -- cgit v1.2.3