[hackers] [dmenu] applied Matthias Christian Ott's sanity fixes (thanks a lot!) || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Sat, 21 Feb 2009 19:21:59 +0000 (UTC)

changeset: 283:78f9f72cc9c6
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Sat Feb 21 19:21:54 2009 +0000
files: config.mk dmenu.c
description:
applied Matthias Christian Ott's sanity fixes (thanks a lot!)

diff -r 13402291bc76 -r 78f9f72cc9c6 config.mk
--- a/config.mk Fri Dec 12 19:58:52 2008 +0000
+++ b/config.mk Sat Feb 21 19:21:54 2009 +0000
@@ -19,7 +19,7 @@
 LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS}
 
 # flags
-CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
+CPPFLAGS = -D_BSD_SOURCE -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
 CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
 LDFLAGS = -s ${LIBS}
 
diff -r 13402291bc76 -r 78f9f72cc9c6 dmenu.c
--- a/dmenu.c Fri Dec 12 19:58:52 2008 +0000
+++ b/dmenu.c Sat Feb 21 19:21:54 2009 +0000
@@ -1,5 +1,4 @@
 /* See LICENSE file for copyright and license details. */
-#define _BSD_SOURCE
 #include <ctype.h>
 #include <locale.h>
 #include <stdarg.h>
@@ -141,7 +140,7 @@
                 do {
                         do {
                                 if((csub = *s++) == 0)
- return (NULL);
+ return NULL;
                         }
                         while(tolower(csub) != c);
                 }
@@ -318,7 +317,7 @@
 
         len = strlen(text);
         buf[0] = 0;
- num = XLookupString(e, buf, sizeof buf, &ksym, 0);
+ num = XLookupString(e, buf, sizeof buf, &ksym, NULL);
         if(IsKeypadKey(ksym)) {
                 if(ksym == XK_KP_Enter)
                         ksym = XK_Return;
@@ -534,7 +533,7 @@
                         maxname = p;
                         max = len;
                 }
- if((new = (Item *)malloc(sizeof(Item))) == NULL)
+ if(!(new = (Item *)malloc(sizeof(Item))))
                         eprint("fatal: could not malloc() %u bytes\n", sizeof(Item));
                 new->next = new->left = new->right = NULL;
                 new->text = p;
@@ -593,7 +592,7 @@
         initfont(font);
 
         /* menu window */
- wa.override_redirect = 1;
+ wa.override_redirect = True;
         wa.background_pixmap = ParentRelative;
         wa.event_mask = ExposureMask | ButtonPressMask | KeyPressMask;
 
@@ -631,7 +630,7 @@
 
         /* pixmap */
         dc.drawable = XCreatePixmap(dpy, root, mw, mh, DefaultDepth(dpy, screen));
- dc.gc = XCreateGC(dpy, root, 0, 0);
+ dc.gc = XCreateGC(dpy, root, 0, NULL);
         XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
         if(!dc.font.set)
                 XSetFont(dpy, dc.gc, dc.font.xfont->fid);
@@ -702,7 +701,7 @@
                                " [-p <prompt>] [-sb <color>] [-sf <color>] [-v]\n");
         if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
                 fprintf(stderr, "warning: no locale support\n");
- if(!(dpy = XOpenDisplay(0)))
+ if(!(dpy = XOpenDisplay(NULL)))
                 eprint("dmenu: cannot open display\n");
         screen = DefaultScreen(dpy);
         root = RootWindow(dpy, screen);
Received on Sat Feb 21 2009 - 19:21:59 UTC

This archive was generated by hypermail 2.2.0 : Sat Feb 21 2009 - 19:24:06 UTC