about summary refs log tree commit diff stats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@gmail.com>2007-10-28 12:52:16 +0100
committerAnselm R. Garbe <garbeam@gmail.com>2007-10-28 12:52:16 +0100
commit34e7872c89613356293d554970d9d56adc4b0a4e (patch)
tree20cce96da67b7d16a0de6099b522bba0ad358653 /dwm.c
parentc36f7c3c5e5db297689765142c64977f6317a21c (diff)
downloaddwm-34e7872c89613356293d554970d9d56adc4b0a4e.tar.gz
replaced Nmacros with LENGTH(x) macro
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/dwm.c b/dwm.c
index 5bd7221..8933e8e 100644
--- a/dwm.c
+++ b/dwm.c
@@ -245,10 +245,10 @@ applyrules(Client *c) {
 	snprintf(buf, sizeof buf, "%s:%s:%s",
 			ch.res_class ? ch.res_class : "",
 			ch.res_name ? ch.res_name : "", c->name);
-	for(i = 0; i < NRULES; i++)
+	for(i = 0; i < LENGTH(rules); i++)
 		if(regs[i].propregex && !regexec(regs[i].propregex, buf, 1, &tmp, 0)) {
 			c->isfloating = rules[i].isfloating;
-			for(j = 0; regs[i].tagregex && j < NTAGS; j++) {
+			for(j = 0; regs[i].tagregex && j < LENGTH(tags); j++) {
 				if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
 					matched = True;
 					c->tags[j] = True;
@@ -307,7 +307,7 @@ buttonpress(XEvent *e) {
 
 	if(barwin == ev->window) {
 		x = 0;
-		for(i = 0; i < NTAGS; i++) {
+		for(i = 0; i < LENGTH(tags); i++) {
 			x += textw(tags[i]);
 			if(ev->x < x) {
 				if(ev->button == Button1) {
@@ -400,8 +400,8 @@ compileregs(void) {
 
 	if(regs)
 		return;
-	regs = emallocz(NRULES * sizeof(Regs));
-	for(i = 0; i < NRULES; i++) {
+	regs = emallocz(LENGTH(rules) * sizeof(Regs));
+	for(i = 0; i < LENGTH(rules); i++) {
 		if(rules[i].prop) {
 			reg = emallocz(sizeof(regex_t));
 			if(regcomp(reg, rules[i].prop, REG_EXTENDED))
@@ -530,7 +530,7 @@ drawbar(void) {
 	int i, x;
 
 	dc.x = dc.y = 0;
-	for(i = 0; i < NTAGS; i++) {
+	for(i = 0; i < LENGTH(tags); i++) {
 		dc.w = textw(tags[i]);
 		if(seltags[i]) {
 			drawtext(tags[i], dc.sel);
@@ -841,8 +841,8 @@ unsigned int
 idxoftag(const char *tag) {
 	unsigned int i;
 
-	for(i = 0; (i < NTAGS) && (tags[i] != tag); i++);
-	return (i < NTAGS) ? i : 0;
+	for(i = 0; (i < LENGTH(tags)) && (tags[i] != tag); i++);
+	return (i < LENGTH(tags)) ? i : 0;
 }
 
 void
@@ -916,7 +916,7 @@ Bool
 isvisible(Client *c) {
 	unsigned int i;
 
-	for(i = 0; i < NTAGS; i++)
+	for(i = 0; i < LENGTH(tags); i++)
 		if(c->tags[i] && seltags[i])
 			return True;
 	return False;
@@ -932,7 +932,7 @@ keypress(XEvent *e) {
 
 	if(!e) { /* grabkeys */
 		XUngrabKey(dpy, AnyKey, AnyModifier, root);
-		for(i = 0; i < NKEYS; i++) {
+		for(i = 0; i < LENGTH(keys); i++) {
 			code = XKeysymToKeycode(dpy, keys[i].keysym);
 			XGrabKey(dpy, code, keys[i].mod, root, True,
 					GrabModeAsync, GrabModeAsync);
@@ -947,7 +947,7 @@ keypress(XEvent *e) {
 	}
 	ev = &e->xkey;
 	keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
-	for(i = 0; i < NKEYS; i++)
+	for(i = 0; i < LENGTH(keys); i++)
 		if(keysym == keys[i].keysym
 		&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state))
 		{
@@ -1366,14 +1366,14 @@ setlayout(const char *arg) {
 	unsigned int i;
 
 	if(!arg) {
-		if(++layout == &layouts[NLAYOUTS])
+		if(++layout == &layouts[LENGTH(layouts)])
 			layout = &layouts[0];
 	}
 	else {
-		for(i = 0; i < NLAYOUTS; i++)
+		for(i = 0; i < LENGTH(layouts); i++)
 			if(!strcmp(arg, layouts[i].symbol))
 				break;
-		if(i == NLAYOUTS)
+		if(i == LENGTH(layouts))
 			return;
 		layout = &layouts[i];
 	}
@@ -1469,7 +1469,7 @@ setup(void) {
 	/* init layouts */
 	mwfact = MWFACT;
 	layout = &layouts[0];
-	for(blw = i = 0; i < NLAYOUTS; i++) {
+	for(blw = i = 0; i < LENGTH(layouts); i++) {
 		j = textw(layouts[i].symbol);
 		if(j > blw)
 			blw = j;
@@ -1527,7 +1527,7 @@ tag(const char *arg) {
 
 	if(!sel)
 		return;
-	for(i = 0; i < NTAGS; i++)
+	for(i = 0; i < LENGTH(tags); i++)
 		sel->tags[i] = (NULL == arg);
 	sel->tags[idxoftag(arg)] = True;
 	arrange();
@@ -1649,8 +1649,8 @@ toggletag(const char *arg) {
 		return;
 	i = idxoftag(arg);
 	sel->tags[i] = !sel->tags[i];
-	for(j = 0; j < NTAGS && !sel->tags[j]; j++);
-	if(j == NTAGS)
+	for(j = 0; j < LENGTH(tags) && !sel->tags[j]; j++);
+	if(j == LENGTH(tags))
 		sel->tags[i] = True; /* at least one tag must be enabled */
 	arrange();
 }
@@ -1661,8 +1661,8 @@ toggleview(const char *arg) {
 
 	i = idxoftag(arg);
 	seltags[i] = !seltags[i];
-	for(j = 0; j < NTAGS && !seltags[j]; j++);
-	if(j == NTAGS)
+	for(j = 0; j < LENGTH(tags) && !seltags[j]; j++);
+	if(j == LENGTH(tags))
 		seltags[i] = True; /* at least one tag must be viewed */
 	arrange();
 }
@@ -1828,7 +1828,7 @@ view(const char *arg) {
 	unsigned int i;
 
 	memcpy(prevtags, seltags, sizeof seltags);
-	for(i = 0; i < NTAGS; i++)
+	for(i = 0; i < LENGTH(tags); i++)
 		seltags[i] = (NULL == arg);
 	seltags[idxoftag(arg)] = True;
 	arrange();
lame/subx/052kernel_string_equal.subx?h=main&id=e9661581f092f3e210b7bd900af058d8b8c4369e'>^
1639687b ^







aff782c4 ^








1639687b ^
dd9ba09a ^
1639687b ^
dd9ba09a ^
6030d7e2 ^
1639687b ^
dd9ba09a ^
6030d7e2 ^
1639687b ^
6030d7e2 ^
1639687b ^

71ee78f2 ^
1639687b ^
6030d7e2 ^
1639687b ^

83315235 ^
1639687b ^
83315235 ^
57628c0e ^
47fe603d ^
71ee78f2 ^
57628c0e ^
4068f0ca ^
71ee78f2 ^
1639687b ^
61b8fe6b ^
1639687b ^
3c420101 ^
1639687b ^
3c420101 ^
71ee78f2 ^

1639687b ^
83315235 ^
47fe603d ^
71ee78f2 ^

6030d7e2 ^
71ee78f2 ^
71ee78f2 ^
6030d7e2 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^




ee9a9237 ^
6030d7e2 ^


57628c0e ^
9d27e966 ^
57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
9d27e966 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^

ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
9d27e966 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
8b9dd2d1 ^
ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
9d27e966 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
8b9dd2d1 ^
ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
9d27e966 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
8b9dd2d1 ^
ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
00439520 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
8b9dd2d1 ^
ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
00439520 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^
03d50cc8 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
8b9dd2d1 ^
ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
6030d7e2 ^
00439520 ^
ee9a9237 ^
6030d7e2 ^


ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^

57628c0e ^


03d50cc8 ^
6030d7e2 ^
1639687b ^
8b9dd2d1 ^
6030d7e2 ^
4224ec81 ^
ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267