aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFRIGN <dev@frign.de>2015-09-28 00:15:03 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-09-28 00:33:26 +0200
commit10fd4f275feaef0b505cc8e65a2deccae69a0968 (patch)
treed85ca9b6d89f98c0db6ebb9d9d93ba0eb8127c2a
parentb048eacc9ddc6ca995783411d4df84c23f3a0351 (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.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/dmenu.c b/dmenu.c
index cf5d976..050b858 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -28,14 +28,13 @@
28/* enums */ 28/* enums */
29enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */ 29enum { SchemeNorm, SchemeSel, SchemeOut, SchemeLast }; /* color schemes */
30 30
31typedef struct Item Item; 31struct item {
32struct 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
38static void appenditem(Item *, Item **, Item **); 37static void appenditem(struct item *, struct item **, struct item **);
39static void calcoffsets(void); 38static void calcoffsets(void);
40static char *cistrstr(const char *, const char *); 39static char *cistrstr(const char *, const char *);
41static void cleanup(void); 40static void cleanup(void);
@@ -56,9 +55,9 @@ static int bh, mw, mh;
56static int sw, sh; /* X display screen geometry width, height */ 55static int sw, sh; /* X display screen geometry width, height */
57static int inputw, promptw; 56static int inputw, promptw;
58static size_t cursor; 57static size_t cursor;
59static Item *items = NULL; 58static struct item *items = NULL;
60static Item *matches, *matchend; 59static struct item *matches, *matchend;
61static Item *prev, *curr, *next, *sel; 60static struct item *prev, *curr, *next, *sel;
62static int mon = -1, screen; 61static int mon = -1, screen;
63 62
64static Atom clip, utf8; 63static Atom clip, utf8;
@@ -75,7 +74,7 @@ static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
75static char *(*fstrstr)(const char *, const char *) = strstr; 74static char *(*fstrstr)(const char *, const char *) = strstr;
76 75
77static void 76static void
78appenditem(Item *item, Item **list, Item **last) 77appenditem(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
135drawmenu(void) 134drawmenu(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 */