some cleanups/fixes inspired by Jukka Salmi's feedback 0464e422
arg@10ksloc.org · 2006-07-21 18:34 4 file(s) · +7 −13
event.c +2 −2
267 267
static void
268 268
keypress(XEvent *e)
269 269
{
270 -
	static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0;
270 +
	static unsigned int len = sizeof(key) / sizeof(key[0]);
271 271
	unsigned int i;
272 272
	KeySym keysym;
273 273
	XKeyEvent *ev = &e->xkey;
370 370
void
371 371
grabkeys()
372 372
{
373 -
	static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0;
373 +
	static unsigned int len = sizeof(key) / sizeof(key[0]);
374 374
	unsigned int i;
375 375
	KeyCode code;
376 376
main.c +2 −1
10 10
#include <stdlib.h>
11 11
#include <string.h>
12 12
#include <unistd.h>
13 +
#include <sys/select.h>
13 14
#include <X11/cursorfont.h>
14 15
#include <X11/Xatom.h>
15 16
#include <X11/Xproto.h>
163 164
int
164 165
main(int argc, char *argv[])
165 166
{
166 -
	int i, n;
167 +
	int i;
167 168
	unsigned int mask;
168 169
	fd_set rd;
169 170
	Bool readin = True;
tag.c +1 −6
165 165
settags(Client *c)
166 166
{
167 167
	char classinst[256];
168 -
	static unsigned int len = rule ? sizeof(rule) / sizeof(rule[0]) : 0;
168 +
	static unsigned int len = sizeof(rule) / sizeof(rule[0]);
169 169
	unsigned int i, j;
170 170
	regex_t regex;
171 171
	regmatch_t tmp;
172 172
	Bool matched = False;
173 173
	XClassHint ch;
174 -
175 -
	if(!len) {
176 -
		c->tags[tsel] = tags[tsel];
177 -
		return;
178 -
	}
179 174
180 175
	if(XGetClassHint(dpy, c->win, &ch)) {
181 176
		snprintf(classinst, sizeof(classinst), "%s:%s",
util.c +2 −4
15 15
static void
16 16
bad_malloc(unsigned int size)
17 17
{
18 -
	fprintf(stderr, "fatal: could not malloc() %d bytes\n",
19 -
			(int) size);
20 -
	exit(EXIT_FAILURE);
18 +
	eprint("fatal: could not malloc() %u bytes\n", size);
21 19
}
22 20
23 21
/* extern */
58 56
			fprintf(stderr, "dwm: execvp %s", argv[0]);
59 57
			perror(" failed");
60 58
		}
61 -
		exit(EXIT_FAILURE);
59 +
		exit(0);
62 60
	}
63 61
	wait(0);
64 62
}