From 8d0b890b4946600e72e0b238fc5364802441c9d8 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Sat, 20 Nov 2021 22:15:54 +0500 Subject: [PATCH] Improve code of func "wintoclient" --- src/dwm.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/dwm.c b/src/dwm.c index f0e9de8..6b391b3 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -1727,13 +1727,14 @@ void updatewmhints(Client *c) Client *wintoclient(Window w) { - Client *c; - Monitor *m; - - for (m = mons; m; m = m->next) - for (c = m->clients; c; c = c->next) - if (c->win == w) + for (Monitor *m = mons; m; m = m->next) { + for (Client *c = m->clients; c; c = c->next) { + if (c->win == w) { return c; + } + } + } + return NULL; }