cleaned up
2ec16d9c
3 file(s) · +31 −12
| 43 | 43 | static Bool running = True; |
|
| 44 | 44 | static Window win; |
|
| 45 | 45 | ||
| 46 | + | Display *dpy; |
|
| 47 | + | DC dc; |
|
| 48 | + | int screen; |
|
| 49 | + | unsigned int mw, mh; |
|
| 50 | + | Window parent; |
|
| 51 | + | ||
| 46 | 52 | void |
|
| 47 | 53 | cleanup(void) { |
|
| 48 | 54 | drawcleanup(); |
| 54 | 54 | static int cmdw = 0; |
|
| 55 | 55 | static int promptw = 0; |
|
| 56 | 56 | static int ret = 0; |
|
| 57 | + | static unsigned int lines = 0; |
|
| 57 | 58 | static unsigned int numlockmask = 0; |
|
| 58 | 59 | static Bool running = True; |
|
| 59 | 60 | static Item *allitems = NULL; /* first of all items */ |
|
| 65 | 66 | static Window win; |
|
| 66 | 67 | static int (*fstrncmp)(const char *, const char *, size_t) = strncmp; |
|
| 67 | 68 | static char *(*fstrstr)(const char *, const char *) = strstr; |
|
| 68 | - | static unsigned int lines = 0; |
|
| 69 | 69 | static void (*calcoffsets)(void) = calcoffsetsh; |
|
| 70 | + | ||
| 71 | + | Display *dpy; |
|
| 72 | + | DC dc; |
|
| 73 | + | int screen; |
|
| 74 | + | unsigned int mw, mh; |
|
| 75 | + | Window parent; |
|
| 70 | 76 | ||
| 71 | 77 | void |
|
| 72 | 78 | appenditem(Item *i, Item **list, Item **last) { |
|
| 131 | 137 | ||
| 132 | 138 | void |
|
| 133 | 139 | cleanup(void) { |
|
| 140 | + | Item *itm; |
|
| 141 | + | ||
| 142 | + | while(allitems) { |
|
| 143 | + | itm = allitems->next; |
|
| 144 | + | free(allitems->text); |
|
| 145 | + | free(allitems); |
|
| 146 | + | allitems = itm; |
|
| 147 | + | } |
|
| 134 | 148 | drawcleanup(); |
|
| 135 | 149 | XDestroyWindow(dpy, win); |
|
| 136 | 150 | XUngrabKeyboard(dpy, CurrentTime); |
|
| 30 | 30 | int textw(const char *text); |
|
| 31 | 31 | ||
| 32 | 32 | /* variables */ |
|
| 33 | - | Display *dpy; |
|
| 34 | - | DC dc; |
|
| 35 | - | int screen; |
|
| 36 | - | unsigned int mw, mh; |
|
| 37 | - | unsigned int spaceitem; |
|
| 38 | - | Window parent; |
|
| 33 | + | extern Display *dpy; |
|
| 34 | + | extern DC dc; |
|
| 35 | + | extern int screen; |
|
| 36 | + | extern unsigned int mw, mh; |
|
| 37 | + | extern Window parent; |
|
| 39 | 38 | ||
| 40 | 39 | /* style */ |
|
| 41 | - | const char *font; |
|
| 42 | - | const char *normbgcolor; |
|
| 43 | - | const char *normfgcolor; |
|
| 44 | - | const char *selbgcolor; |
|
| 45 | - | const char *selfgcolor; |
|
| 40 | + | extern const char *font; |
|
| 41 | + | extern const char *normbgcolor; |
|
| 42 | + | extern const char *normfgcolor; |
|
| 43 | + | extern const char *selbgcolor; |
|
| 44 | + | extern const char *selfgcolor; |