diff options
-rw-r--r-- | draw.c | 15 | ||||
-rw-r--r-- | main.c | 18 | ||||
-rw-r--r-- | util.c | 12 |
3 files changed, 15 insertions, 30 deletions
@@ -10,8 +10,7 @@ | |||
10 | /* static */ | 10 | /* static */ |
11 | 11 | ||
12 | static unsigned int | 12 | static unsigned int |
13 | textnw(const char *text, unsigned int len) | 13 | textnw(const char *text, unsigned int len) { |
14 | { | ||
15 | XRectangle r; | 14 | XRectangle r; |
16 | 15 | ||
17 | if(dc.font.set) { | 16 | if(dc.font.set) { |
@@ -24,8 +23,7 @@ textnw(const char *text, unsigned int len) | |||
24 | /* extern */ | 23 | /* extern */ |
25 | 24 | ||
26 | void | 25 | void |
27 | drawtext(const char *text, unsigned long col[ColLast]) | 26 | drawtext(const char *text, unsigned long col[ColLast]) { |
28 | { | ||
29 | int x, y, w, h; | 27 | int x, y, w, h; |
30 | static char buf[256]; | 28 | static char buf[256]; |
31 | unsigned int len, olen; | 29 | unsigned int len, olen; |
@@ -78,8 +76,7 @@ drawtext(const char *text, unsigned long col[ColLast]) | |||
78 | } | 76 | } |
79 | 77 | ||
80 | unsigned long | 78 | unsigned long |
81 | getcolor(const char *colstr) | 79 | getcolor(const char *colstr) { |
82 | { | ||
83 | Colormap cmap = DefaultColormap(dpy, screen); | 80 | Colormap cmap = DefaultColormap(dpy, screen); |
84 | XColor color; | 81 | XColor color; |
85 | 82 | ||
@@ -88,8 +85,7 @@ getcolor(const char *colstr) | |||
88 | } | 85 | } |
89 | 86 | ||
90 | void | 87 | void |
91 | setfont(const char *fontstr) | 88 | setfont(const char *fontstr) { |
92 | { | ||
93 | char **missing, *def; | 89 | char **missing, *def; |
94 | int i, n; | 90 | int i, n; |
95 | 91 | ||
@@ -137,7 +133,6 @@ setfont(const char *fontstr) | |||
137 | } | 133 | } |
138 | 134 | ||
139 | unsigned int | 135 | unsigned int |
140 | textw(const char *text) | 136 | textw(const char *text) { |
141 | { | ||
142 | return textnw(text, strlen(text)) + dc.font.height; | 137 | return textnw(text, strlen(text)) + dc.font.height; |
143 | } | 138 | } |
@@ -42,8 +42,7 @@ static Window root; | |||
42 | static Window win; | 42 | static Window win; |
43 | 43 | ||
44 | static void | 44 | static void |
45 | calcoffsets() | 45 | calcoffsets() { |
46 | { | ||
47 | unsigned int tw, w; | 46 | unsigned int tw, w; |
48 | 47 | ||
49 | if(!curr) | 48 | if(!curr) |
@@ -71,8 +70,7 @@ calcoffsets() | |||
71 | } | 70 | } |
72 | 71 | ||
73 | static void | 72 | static void |
74 | drawmenu() | 73 | drawmenu() { |
75 | { | ||
76 | Item *i; | 74 | Item *i; |
77 | 75 | ||
78 | dc.x = 0; | 76 | dc.x = 0; |
@@ -110,8 +108,7 @@ drawmenu() | |||
110 | } | 108 | } |
111 | 109 | ||
112 | static void | 110 | static void |
113 | match(char *pattern) | 111 | match(char *pattern) { |
114 | { | ||
115 | unsigned int plen; | 112 | unsigned int plen; |
116 | Item *i, *j; | 113 | Item *i, *j; |
117 | 114 | ||
@@ -151,8 +148,7 @@ match(char *pattern) | |||
151 | } | 148 | } |
152 | 149 | ||
153 | static void | 150 | static void |
154 | kpress(XKeyEvent * e) | 151 | kpress(XKeyEvent * e) { |
155 | { | ||
156 | char buf[32]; | 152 | char buf[32]; |
157 | int num, prev_nitem; | 153 | int num, prev_nitem; |
158 | unsigned int i, len; | 154 | unsigned int i, len; |
@@ -251,8 +247,7 @@ kpress(XKeyEvent * e) | |||
251 | } | 247 | } |
252 | 248 | ||
253 | static char * | 249 | static char * |
254 | readstdin() | 250 | readstdin() { |
255 | { | ||
256 | static char *maxname = NULL; | 251 | static char *maxname = NULL; |
257 | char *p, buf[1024]; | 252 | char *p, buf[1024]; |
258 | unsigned int len = 0, max = 0; | 253 | unsigned int len = 0, max = 0; |
@@ -289,8 +284,7 @@ Display *dpy; | |||
289 | DC dc = {0}; | 284 | DC dc = {0}; |
290 | 285 | ||
291 | int | 286 | int |
292 | main(int argc, char *argv[]) | 287 | main(int argc, char *argv[]) { |
293 | { | ||
294 | char *maxname; | 288 | char *maxname; |
295 | fd_set rd; | 289 | fd_set rd; |
296 | struct timeval timeout; | 290 | struct timeval timeout; |
@@ -13,16 +13,14 @@ | |||
13 | /* static */ | 13 | /* static */ |
14 | 14 | ||
15 | static void | 15 | static void |
16 | badmalloc(unsigned int size) | 16 | badmalloc(unsigned int size) { |
17 | { | ||
18 | eprint("fatal: could not malloc() %u bytes\n", size); | 17 | eprint("fatal: could not malloc() %u bytes\n", size); |
19 | } | 18 | } |
20 | 19 | ||
21 | /* extern */ | 20 | /* extern */ |
22 | 21 | ||
23 | void * | 22 | void * |
24 | emalloc(unsigned int size) | 23 | emalloc(unsigned int size) { |
25 | { | ||
26 | void *res = malloc(size); | 24 | void *res = malloc(size); |
27 | if(!res) | 25 | if(!res) |
28 | badmalloc(size); | 26 | badmalloc(size); |
@@ -30,8 +28,7 @@ emalloc(unsigned int size) | |||
30 | } | 28 | } |
31 | 29 | ||
32 | void | 30 | void |
33 | eprint(const char *errstr, ...) | 31 | eprint(const char *errstr, ...) { |
34 | { | ||
35 | va_list ap; | 32 | va_list ap; |
36 | 33 | ||
37 | va_start(ap, errstr); | 34 | va_start(ap, errstr); |
@@ -41,8 +38,7 @@ eprint(const char *errstr, ...) | |||
41 | } | 38 | } |
42 | 39 | ||
43 | char * | 40 | char * |
44 | estrdup(const char *str) | 41 | estrdup(const char *str) { |
45 | { | ||
46 | void *res = strdup(str); | 42 | void *res = strdup(str); |
47 | if(!res) | 43 | if(!res) |
48 | badmalloc(strlen(str)); | 44 | badmalloc(strlen(str)); |