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

From: <explosion0mental_AT_gmail.com>
Date: Mon, 29 Aug 2022 17:49:06 -0500

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
Received on Tue Aug 30 2022 - 00:49:06 CEST

This archive was generated by hypermail 2.3.0 : Tue Aug 30 2022 - 06:12:36 CEST