[PATCH] Removed unnecessary scope blocks

From: Eric Pruitt <eric.pruitt_AT_gmail.com>
Date: Sun, 3 Jul 2016 10:10:30 -0700

---
 dwm.c | 60 ++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 28 deletions(-)
diff --git a/dwm.c b/dwm.c
index b2bc9bd..9901737 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -943,41 +943,45 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
 void
 grabbuttons(Client *c, int focused)
 {
+	unsigned int i, j;
+	unsigned int modifiers[4];
 	updatenumlockmask();
-	{
-		unsigned int i, j;
-		unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
-		XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
-		if (focused) {
-			for (i = 0; i < LENGTH(buttons); i++)
-				if (buttons[i].click == ClkClientWin)
-					for (j = 0; j < LENGTH(modifiers); j++)
-						XGrabButton(dpy, buttons[i].button,
-						            buttons[i].mask | modifiers[j],
-						            c->win, False, BUTTONMASK,
-						            GrabModeAsync, GrabModeSync, None, None);
-		} else
-			XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
-			            BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
-	}
+	modifiers[0] = 0;
+	modifiers[1] = LockMask;
+	modifiers[2] = numlockmask;
+	modifiers[3] = numlockmask|LockMask;
+	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
+	if (focused) {
+		for (i = 0; i < LENGTH(buttons); i++)
+			if (buttons[i].click == ClkClientWin)
+				for (j = 0; j < LENGTH(modifiers); j++)
+					XGrabButton(dpy, buttons[i].button,
+								buttons[i].mask | modifiers[j],
+								c->win, False, BUTTONMASK,
+								GrabModeAsync, GrabModeSync, None, None);
+	} else
+		XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
+					BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
 }
 
 void
 grabkeys(void)
 {
-	updatenumlockmask();
-	{
-		unsigned int i, j;
-		unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
-		KeyCode code;
+	unsigned int i, j;
+	unsigned int modifiers[4];
+	KeyCode code;
 
-		XUngrabKey(dpy, AnyKey, AnyModifier, root);
-		for (i = 0; i < LENGTH(keys); i++)
-			if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
-				for (j = 0; j < LENGTH(modifiers); j++)
-					XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
-						 True, GrabModeAsync, GrabModeAsync);
-	}
+	updatenumlockmask();
+	modifiers[0] = 0;
+	modifiers[1] = LockMask;
+	modifiers[2] = numlockmask;
+	modifiers[3] = numlockmask|LockMask;
+	XUngrabKey(dpy, AnyKey, AnyModifier, root);
+	for (i = 0; i < LENGTH(keys); i++)
+		if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
+			for (j = 0; j < LENGTH(modifiers); j++)
+				XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
+					 True, GrabModeAsync, GrabModeAsync);
 }
 
 void
-- 
2.1.4
--3V7upXqbjpZ4EhLz--
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 03 2016 - 23:12:05 CEST