Untypedef struct item
10fd4f27
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.
1 file(s) · +9 −10
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.
| 28 | 28 | /* enums */ |
|
| 29 | 29 | enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ |
|
| 30 | 30 | ||
| 31 | - | typedef struct Item Item; |
|
| 32 | - | struct Item { |
|
| 31 | + | struct item { |
|
| 33 | 32 | char *text; |
|
| 34 | - | Item *left, *right; |
|
| 33 | + | struct item *left, *right; |
|
| 35 | 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 | 38 | static void calcoffsets(void); |
|
| 40 | 39 | static char *cistrstr(const char *, const char *); |
|
| 41 | 40 | static void cleanup(void); |
|
| 56 | 55 | static int sw, sh; /* X display screen geometry width, height */ |
|
| 57 | 56 | static int inputw, promptw; |
|
| 58 | 57 | static size_t cursor; |
|
| 59 | - | static Item *items = NULL; |
|
| 60 | - | static Item *matches, *matchend; |
|
| 61 | - | static Item *prev, *curr, *next, *sel; |
|
| 58 | + | static struct item *items = NULL; |
|
| 59 | + | static struct item *matches, *matchend; |
|
| 60 | + | static struct item *prev, *curr, *next, *sel; |
|
| 62 | 61 | static int mon = -1, screen; |
|
| 63 | 62 | ||
| 64 | 63 | static Atom clip, utf8; |
|
| 75 | 74 | static char *(*fstrstr)(const char *, const char *) = strstr; |
|
| 76 | 75 | ||
| 77 | 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 | 79 | if (*last) |
|
| 81 | 80 | (*last)->right = item; |
|
| 135 | 134 | drawmenu(void) |
|
| 136 | 135 | { |
|
| 137 | 136 | int curpos; |
|
| 138 | - | Item *item; |
|
| 137 | + | struct item *item; |
|
| 139 | 138 | int x = 0, y = 0, h = bh, w; |
|
| 140 | 139 | ||
| 141 | 140 | drw_setscheme(drw, &scheme[SchemeNorm]); |
|
| 408 | 407 | char buf[sizeof text], *s; |
|
| 409 | 408 | int i, tokc = 0; |
|
| 410 | 409 | size_t len; |
|
| 411 | - | Item *item, *lprefix, *lsubstr, *prefixend, *substrend; |
|
| 410 | + | struct item *item, *lprefix, *lsubstr, *prefixend, *substrend; |
|
| 412 | 411 | ||
| 413 | 412 | strcpy(buf, text); |
|
| 414 | 413 | /* separate input text into tokens to be matched individually */ |
|