1
0

made function signatures more consistent to my coding style

This commit is contained in:
Anselm R. Garbe 2006-09-12 10:59:00 +02:00
parent 0e5f467aa8
commit 81bcf078f6
3 changed files with 15 additions and 30 deletions

15
draw.c
View File

@ -10,8 +10,7 @@
/* static */ /* static */
static unsigned int static unsigned int
textnw(const char *text, unsigned int len) textnw(const char *text, unsigned int len) {
{
XRectangle r; XRectangle r;
if(dc.font.set) { if(dc.font.set) {
@ -24,8 +23,7 @@ textnw(const char *text, unsigned int len)
/* extern */ /* extern */
void void
drawtext(const char *text, unsigned long col[ColLast]) drawtext(const char *text, unsigned long col[ColLast]) {
{
int x, y, w, h; int x, y, w, h;
static char buf[256]; static char buf[256];
unsigned int len, olen; unsigned int len, olen;
@ -78,8 +76,7 @@ drawtext(const char *text, unsigned long col[ColLast])
} }
unsigned long unsigned long
getcolor(const char *colstr) getcolor(const char *colstr) {
{
Colormap cmap = DefaultColormap(dpy, screen); Colormap cmap = DefaultColormap(dpy, screen);
XColor color; XColor color;
@ -88,8 +85,7 @@ getcolor(const char *colstr)
} }
void void
setfont(const char *fontstr) setfont(const char *fontstr) {
{
char **missing, *def; char **missing, *def;
int i, n; int i, n;
@ -137,7 +133,6 @@ setfont(const char *fontstr)
} }
unsigned int unsigned int
textw(const char *text) textw(const char *text) {
{
return textnw(text, strlen(text)) + dc.font.height; return textnw(text, strlen(text)) + dc.font.height;
} }

18
main.c
View File

@ -42,8 +42,7 @@ static Window root;
static Window win; static Window win;
static void static void
calcoffsets() calcoffsets() {
{
unsigned int tw, w; unsigned int tw, w;
if(!curr) if(!curr)
@ -71,8 +70,7 @@ calcoffsets()
} }
static void static void
drawmenu() drawmenu() {
{
Item *i; Item *i;
dc.x = 0; dc.x = 0;
@ -110,8 +108,7 @@ drawmenu()
} }
static void static void
match(char *pattern) match(char *pattern) {
{
unsigned int plen; unsigned int plen;
Item *i, *j; Item *i, *j;
@ -151,8 +148,7 @@ match(char *pattern)
} }
static void static void
kpress(XKeyEvent * e) kpress(XKeyEvent * e) {
{
char buf[32]; char buf[32];
int num, prev_nitem; int num, prev_nitem;
unsigned int i, len; unsigned int i, len;
@ -251,8 +247,7 @@ kpress(XKeyEvent * e)
} }
static char * static char *
readstdin() readstdin() {
{
static char *maxname = NULL; static char *maxname = NULL;
char *p, buf[1024]; char *p, buf[1024];
unsigned int len = 0, max = 0; unsigned int len = 0, max = 0;
@ -289,8 +284,7 @@ Display *dpy;
DC dc = {0}; DC dc = {0};
int int
main(int argc, char *argv[]) main(int argc, char *argv[]) {
{
char *maxname; char *maxname;
fd_set rd; fd_set rd;
struct timeval timeout; struct timeval timeout;

12
util.c
View File

@ -13,16 +13,14 @@
/* static */ /* static */
static void static void
badmalloc(unsigned int size) badmalloc(unsigned int size) {
{
eprint("fatal: could not malloc() %u bytes\n", size); eprint("fatal: could not malloc() %u bytes\n", size);
} }
/* extern */ /* extern */
void * void *
emalloc(unsigned int size) emalloc(unsigned int size) {
{
void *res = malloc(size); void *res = malloc(size);
if(!res) if(!res)
badmalloc(size); badmalloc(size);
@ -30,8 +28,7 @@ emalloc(unsigned int size)
} }
void void
eprint(const char *errstr, ...) eprint(const char *errstr, ...) {
{
va_list ap; va_list ap;
va_start(ap, errstr); va_start(ap, errstr);
@ -41,8 +38,7 @@ eprint(const char *errstr, ...)
} }
char * char *
estrdup(const char *str) estrdup(const char *str) {
{
void *res = strdup(str); void *res = strdup(str);
if(!res) if(!res)
badmalloc(strlen(str)); badmalloc(strlen(str));