diff options
author | FRIGN <dev@frign.de> | 2015-09-28 00:15:03 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-09-28 00:33:26 +0200 |
commit | 10fd4f275feaef0b505cc8e65a2deccae69a0968 (patch) | |
tree | d85ca9b6d89f98c0db6ebb9d9d93ba0eb8127c2a | |
parent | b048eacc9ddc6ca995783411d4df84c23f3a0351 (diff) |
Untypedef struct item
Adds clarity. Typedefs for structs are definitely a discussion matter,
but there's no reason to hide a simple data-structure behind a
meaningless typedef.
-rw-r--r-- | dmenu.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -28,14 +28,13 @@ | |||
28 | /* enums */ | 28 | /* enums */ |
29 | enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ | 29 | enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ |
30 | 30 | ||
31 | typedef struct Item Item; | 31 | struct item { |
32 | struct Item { | ||
33 | char *text; | 32 | char *text; |
34 | Item *left, *right; | 33 | struct item *left, *right; |
35 | bool out; | 34 | bool out; |
36 | }; | 35 | }; |
37 | 36 | ||
38 | static void appenditem(Item *, Item **, Item **); | 37 | static void appenditem(struct item *, struct item **, struct item **); |
39 | static void calcoffsets(void); | 38 | static void calcoffsets(void); |
40 | static char *cistrstr(const char *, const char *); | 39 | static char *cistrstr(const char *, const char *); |
41 | static void cleanup(void); | 40 | static void cleanup(void); |
@@ -56,9 +55,9 @@ static int bh, mw, mh; | |||
56 | static int sw, sh; /* X display screen geometry width, height */ | 55 | static int sw, sh; /* X display screen geometry width, height */ |
57 | static int inputw, promptw; | 56 | static int inputw, promptw; |
58 | static size_t cursor; | 57 | static size_t cursor; |
59 | static Item *items = NULL; | 58 | static struct item *items = NULL; |
60 | static Item *matches, *matchend; | 59 | static struct item *matches, *matchend; |
61 | static Item *prev, *curr, *next, *sel; | 60 | static struct item *prev, *curr, *next, *sel; |
62 | static int mon = -1, screen; | 61 | static int mon = -1, screen; |
63 | 62 | ||
64 | static Atom clip, utf8; | 63 | static Atom clip, utf8; |
@@ -75,7 +74,7 @@ static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; | |||
75 | static char *(*fstrstr)(const char *, const char *) = strstr; | 74 | static char *(*fstrstr)(const char *, const char *) = strstr; |
76 | 75 | ||
77 | static void | 76 | static void |
78 | appenditem(Item *item, Item **list, Item **last) | 77 | appenditem(struct item *item, struct item **list, struct item **last) |
79 | { | 78 | { |
80 | if (*last) | 79 | if (*last) |
81 | (*last)->right = item; | 80 | (*last)->right = item; |
@@ -135,7 +134,7 @@ static void | |||
135 | drawmenu(void) | 134 | drawmenu(void) |
136 | { | 135 | { |
137 | int curpos; | 136 | int curpos; |
138 | Item *item; | 137 | struct item *item; |
139 | int x = 0, y = 0, h = bh, w; | 138 | int x = 0, y = 0, h = bh, w; |
140 | 139 | ||
141 | drw_setscheme(drw, &scheme[SchemeNorm]); | 140 | drw_setscheme(drw, &scheme[SchemeNorm]); |
@@ -408,7 +407,7 @@ match(void) | |||
408 | char buf[sizeof text], *s; | 407 | char buf[sizeof text], *s; |
409 | int i, tokc = 0; | 408 | int i, tokc = 0; |
410 | size_t len; | 409 | size_t len; |
411 | Item *item, *lprefix, *lsubstr, *prefixend, *substrend; | 410 | struct item *item, *lprefix, *lsubstr, *prefixend, *substrend; |
412 | 411 | ||
413 | strcpy(buf, text); | 412 | strcpy(buf, text); |
414 | /* separate input text into tokens to be matched individually */ | 413 | /* separate input text into tokens to be matched individually */ |