aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnselm R. Garbe <arg@10kloc.org>2006-09-12 10:59:00 +0200
committerAnselm R. Garbe <arg@10kloc.org>2006-09-12 10:59:00 +0200
commit81bcf078f6c510314f140471efb8952160fdb3ad (patch)
tree2a85bc526dd9787a0e25be779263903e6f855768
parent0e5f467aa85e318ed27fc5d6d3826426a06ef3c3 (diff)
made function signatures more consistent to my coding style
-rw-r--r--draw.c15
-rw-r--r--main.c18
-rw-r--r--util.c12
3 files changed, 15 insertions, 30 deletions
diff --git a/draw.c b/draw.c
index d0f21cd..10a011d 100644
--- a/draw.c
+++ b/draw.c
@@ -10,8 +10,7 @@
10/* static */ 10/* static */
11 11
12static unsigned int 12static unsigned int
13textnw(const char *text, unsigned int len) 13textnw(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
26void 25void
27drawtext(const char *text, unsigned long col[ColLast]) 26drawtext(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
80unsigned long 78unsigned long
81getcolor(const char *colstr) 79getcolor(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
90void 87void
91setfont(const char *fontstr) 88setfont(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
139unsigned int 135unsigned int
140textw(const char *text) 136textw(const char *text) {
141{
142 return textnw(text, strlen(text)) + dc.font.height; 137 return textnw(text, strlen(text)) + dc.font.height;
143} 138}
diff --git a/main.c b/main.c
index 03c8b1f..60567b2 100644
--- a/main.c
+++ b/main.c
@@ -42,8 +42,7 @@ static Window root;
42static Window win; 42static Window win;
43 43
44static void 44static void
45calcoffsets() 45calcoffsets() {
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
73static void 72static void
74drawmenu() 73drawmenu() {
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
112static void 110static void
113match(char *pattern) 111match(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
153static void 150static void
154kpress(XKeyEvent * e) 151kpress(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
253static char * 249static char *
254readstdin() 250readstdin() {
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;
289DC dc = {0}; 284DC dc = {0};
290 285
291int 286int
292main(int argc, char *argv[]) 287main(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;
diff --git a/util.c b/util.c
index 0e8828c..d0444c5 100644
--- a/util.c
+++ b/util.c
@@ -13,16 +13,14 @@
13/* static */ 13/* static */
14 14
15static void 15static void
16badmalloc(unsigned int size) 16badmalloc(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
23void * 22void *
24emalloc(unsigned int size) 23emalloc(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
32void 30void
33eprint(const char *errstr, ...) 31eprint(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
43char * 40char *
44estrdup(const char *str) 41estrdup(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));