[hackers] [dmenu] cleaned up || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Wed, 23 Jun 2010 12:49:28 +0000 (UTC)

changeset: 319:419700a90269
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Wed Jun 23 13:49:24 2010 +0100
files: dinput.c dmenu.c draw.h
description:
cleaned up

diff -r f5393d652c75 -r 419700a90269 dinput.c
--- a/dinput.c Wed Jun 23 13:31:11 2010 +0100
+++ b/dinput.c Wed Jun 23 13:49:24 2010 +0100
@@ -43,6 +43,12 @@
 static Bool running = True;
 static Window win;
 
+Display *dpy;
+DC dc;
+int screen;
+unsigned int mw, mh;
+Window parent;
+
 void
 cleanup(void) {
         drawcleanup();
diff -r f5393d652c75 -r 419700a90269 dmenu.c
--- a/dmenu.c Wed Jun 23 13:31:11 2010 +0100
+++ b/dmenu.c Wed Jun 23 13:49:24 2010 +0100
@@ -54,6 +54,7 @@
 static int cmdw = 0;
 static int promptw = 0;
 static int ret = 0;
+static unsigned int lines = 0;
 static unsigned int numlockmask = 0;
 static Bool running = True;
 static Item *allitems = NULL; /* first of all items */
@@ -65,9 +66,14 @@
 static Window win;
 static int (*fstrncmp)(const char *, const char *, size_t) = strncmp;
 static char *(*fstrstr)(const char *, const char *) = strstr;
-static unsigned int lines = 0;
 static void (*calcoffsets)(void) = calcoffsetsh;
 
+Display *dpy;
+DC dc;
+int screen;
+unsigned int mw, mh;
+Window parent;
+
 void
 appenditem(Item *i, Item **list, Item **last) {
         if(!(*last))
@@ -131,6 +137,14 @@
 
 void
 cleanup(void) {
+ Item *itm;
+
+ while(allitems) {
+ itm = allitems->next;
+ free(allitems->text);
+ free(allitems);
+ allitems = itm;
+ }
         drawcleanup();
         XDestroyWindow(dpy, win);
         XUngrabKeyboard(dpy, CurrentTime);
diff -r f5393d652c75 -r 419700a90269 draw.h
--- a/draw.h Wed Jun 23 13:31:11 2010 +0100
+++ b/draw.h Wed Jun 23 13:49:24 2010 +0100
@@ -30,16 +30,15 @@
 int textw(const char *text);
 
 /* variables */
-Display *dpy;
-DC dc;
-int screen;
-unsigned int mw, mh;
-unsigned int spaceitem;
-Window parent;
+extern Display *dpy;
+extern DC dc;
+extern int screen;
+extern unsigned int mw, mh;
+extern Window parent;
 
 /* style */
-const char *font;
-const char *normbgcolor;
-const char *normfgcolor;
-const char *selbgcolor;
-const char *selfgcolor;
+extern const char *font;
+extern const char *normbgcolor;
+extern const char *normfgcolor;
+extern const char *selbgcolor;
+extern const char *selfgcolor;
Received on Wed Jun 23 2010 - 12:49:28 UTC

This archive was generated by hypermail 2.2.0 : Wed Jun 23 2010 - 13:00:08 UTC