aewl
changeset 138:c1185dc7a36e
some cleanups/fixes inspired by Jukka Salmi's feedback
author | arg@10ksloc.org |
---|---|
date | Fri, 21 Jul 2006 18:34:10 +0200 |
parents | 77922a389fa8 |
children | 22213b9a2114 |
files | event.c main.c tag.c util.c |
diffstat | 4 files changed, 7 insertions(+), 13 deletions(-) [+] |
line diff
1.1 --- a/event.c Fri Jul 21 14:11:38 2006 +0200 1.2 +++ b/event.c Fri Jul 21 18:34:10 2006 +0200 1.3 @@ -267,7 +267,7 @@ 1.4 static void 1.5 keypress(XEvent *e) 1.6 { 1.7 - static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0; 1.8 + static unsigned int len = sizeof(key) / sizeof(key[0]); 1.9 unsigned int i; 1.10 KeySym keysym; 1.11 XKeyEvent *ev = &e->xkey; 1.12 @@ -370,7 +370,7 @@ 1.13 void 1.14 grabkeys() 1.15 { 1.16 - static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0; 1.17 + static unsigned int len = sizeof(key) / sizeof(key[0]); 1.18 unsigned int i; 1.19 KeyCode code; 1.20
2.1 --- a/main.c Fri Jul 21 14:11:38 2006 +0200 2.2 +++ b/main.c Fri Jul 21 18:34:10 2006 +0200 2.3 @@ -10,6 +10,7 @@ 2.4 #include <stdlib.h> 2.5 #include <string.h> 2.6 #include <unistd.h> 2.7 +#include <sys/select.h> 2.8 #include <X11/cursorfont.h> 2.9 #include <X11/Xatom.h> 2.10 #include <X11/Xproto.h> 2.11 @@ -163,7 +164,7 @@ 2.12 int 2.13 main(int argc, char *argv[]) 2.14 { 2.15 - int i, n; 2.16 + int i; 2.17 unsigned int mask; 2.18 fd_set rd; 2.19 Bool readin = True;
3.1 --- a/tag.c Fri Jul 21 14:11:38 2006 +0200 3.2 +++ b/tag.c Fri Jul 21 18:34:10 2006 +0200 3.3 @@ -165,18 +165,13 @@ 3.4 settags(Client *c) 3.5 { 3.6 char classinst[256]; 3.7 - static unsigned int len = rule ? sizeof(rule) / sizeof(rule[0]) : 0; 3.8 + static unsigned int len = sizeof(rule) / sizeof(rule[0]); 3.9 unsigned int i, j; 3.10 regex_t regex; 3.11 regmatch_t tmp; 3.12 Bool matched = False; 3.13 XClassHint ch; 3.14 3.15 - if(!len) { 3.16 - c->tags[tsel] = tags[tsel]; 3.17 - return; 3.18 - } 3.19 - 3.20 if(XGetClassHint(dpy, c->win, &ch)) { 3.21 snprintf(classinst, sizeof(classinst), "%s:%s", 3.22 ch.res_class ? ch.res_class : "",
4.1 --- a/util.c Fri Jul 21 14:11:38 2006 +0200 4.2 +++ b/util.c Fri Jul 21 18:34:10 2006 +0200 4.3 @@ -15,9 +15,7 @@ 4.4 static void 4.5 bad_malloc(unsigned int size) 4.6 { 4.7 - fprintf(stderr, "fatal: could not malloc() %d bytes\n", 4.8 - (int) size); 4.9 - exit(EXIT_FAILURE); 4.10 + eprint("fatal: could not malloc() %u bytes\n", size); 4.11 } 4.12 4.13 /* extern */ 4.14 @@ -58,7 +56,7 @@ 4.15 fprintf(stderr, "dwm: execvp %s", argv[0]); 4.16 perror(" failed"); 4.17 } 4.18 - exit(EXIT_FAILURE); 4.19 + exit(0); 4.20 } 4.21 wait(0); 4.22 }