Re: [hackers] [dwm][PATCH] applyrules: read rules[] with the `r` pointer directly

From: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Tue, 30 Aug 2022 10:29:32 +0200

On Mon, Aug 29, 2022 at 05:49:06PM -0500, explosion0mental_AT_gmail.com wrote:
> From: explosion-mental <explosion0mental_AT_gmail.com>
>
> no need for `i` so remove the i variable.
>
> :gigachad:
> ---
> dwm.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/dwm.c b/dwm.c
> index e5efb6a..c2dcb15 100644
> --- a/dwm.c
> +++ b/dwm.c
> _AT_@ -280,7 +280,6 @@ void
> applyrules(Client *c)
> {
> const char *class, *instance;
> - unsigned int i;
> const Rule *r;
> Monitor *m;
> XClassHint ch = { NULL, NULL };
> _AT_@ -292,8 +291,7 @@ applyrules(Client *c)
> class = ch.res_class ? ch.res_class : broken;
> instance = ch.res_name ? ch.res_name : broken;
>
> - for (i = 0; i < LENGTH(rules); i++) {
> - r = &rules[i];
> + for (r = &rules[0]; r <= &rules[LENGTH(rules) - 1]; r++) {
> if ((!r->title || strstr(c->name, r->title))
> && (!r->class || strstr(class, r->class))
> && (!r->instance || strstr(instance, r->instance)))
> --
> 2.37.2
>
>

The current code-style is more clear.

Please don't use ":gigachad:" or such in commit messages.

-- 
Kind regards,
Hiltjo
Received on Tue Aug 30 2022 - 10:29:32 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 30 2022 - 10:36:35 CEST