exposay: move constant value calculation out of loop
authorLeandro Ribeiro <leandrohr@riseup.net>
Mon, 30 Dec 2019 22:11:51 +0000 (19:11 -0300)
committerDaniel Stone <daniels@collabora.com>
Wed, 26 Aug 2020 14:10:50 +0000 (14:10 +0000)
In exposay_layout(), int pad is being calculated within the
loop. This is unnecessary, as its value is constant. Move it
out of the loop.

Signed-off-by: Leandro Ribeiro <leandrohr@riseup.net>
desktop-shell/exposay.c

index 9fd4383..b1a8d34 100644 (file)
@@ -219,6 +219,7 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
        struct weston_view *view;
        struct exposay_surface *esurface, *highlight = NULL;
        int w, h;
+       int pad;
        int i;
        int last_row_removed = 0;
 
@@ -275,11 +276,10 @@ exposay_layout(struct desktop_shell *shell, struct shell_output *shell_output)
        if (eoutput->surface_size > (output->height / 2))
                eoutput->surface_size = output->height / 2;
 
+       pad = eoutput->surface_size + eoutput->padding_inner;
+
        i = 0;
        wl_list_for_each(view, &workspace->layer.view_list.link, layer_link.link) {
-               int pad;
-
-               pad = eoutput->surface_size + eoutput->padding_inner;
 
                if (!get_shell_surface(view->surface))
                        continue;