[hackers] [libdraw] renamed eprintf || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Sat, 31 Jul 2010 13:54:15 +0000 (UTC)

changeset: 6:c6de8835d7d5
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Sat Jul 31 14:54:11 2010 +0100
files: Makefile commitdraw.c draw.h drawtext.c eprint.c eprintf.c getcolor.c initfont.c setupdraw.c textnw.c
description:
renamed eprintf

diff -r 1eb993cafe2a -r c6de8835d7d5 Makefile
--- a/Makefile Fri Jul 30 10:25:41 2010 +0100
+++ b/Makefile Sat Jul 31 14:54:11 2010 +0100
@@ -4,7 +4,7 @@
 include config.mk
 
 SRC = cleanupdraw.c commitdraw.c drawbox.c drawline.c drawsquare.c drawtext.c \
- drawtextn.c eprint.c getcolor.c initfont.c setupdraw.c textnw.c textw.c
+ drawtextn.c eprintf.c getcolor.c initfont.c setupdraw.c textnw.c textw.c
 OBJ = ${SRC:.c=.o}
 
 all: options libdraw.a
diff -r 1eb993cafe2a -r c6de8835d7d5 commitdraw.c
--- a/commitdraw.c Fri Jul 30 10:25:41 2010 +0100
+++ b/commitdraw.c Sat Jul 31 14:54:11 2010 +0100
@@ -7,6 +7,6 @@
         XWindowAttributes wa;
 
         if(!XGetWindowAttributes(dc->dpy, w, &wa))
- eprint("cannot get window attributes\n");
+ eprintf("cannot get window attributes\n");
         XCopyArea(dc->dpy, dc->drawable, w, dc->gc, 0, 0, wa.width, wa.height, 0, 0);
 }
diff -r 1eb993cafe2a -r c6de8835d7d5 draw.h
--- a/draw.h Fri Jul 30 10:25:41 2010 +0100
+++ b/draw.h Sat Jul 31 14:54:11 2010 +0100
@@ -35,7 +35,7 @@
 void drawsquare(DC *dc, Bool filled, unsigned long col[ColLast]);
 void drawtext(DC *dc, const char *text, unsigned long col[ColLast]);
 void drawtextn(DC *dc, const char *text, size_t n, unsigned long col[ColLast]);
-void eprint(const char *fmt, ...);
+void eprintf(const char *fmt, ...);
 unsigned long getcolor(DC *dc, const char *colstr);
 void initfont(DC *dc, const char *fontstr);
 void setupdraw(DC *dc, Window w);
diff -r 1eb993cafe2a -r c6de8835d7d5 drawtext.c
--- a/drawtext.c Fri Jul 30 10:25:41 2010 +0100
+++ b/drawtext.c Sat Jul 31 14:54:11 2010 +0100
@@ -4,5 +4,5 @@
 
 void
 drawtext(DC *dc, const char *text, unsigned long col[ColLast]) {
- drawtextn(dc, text, text ? strlen(text) : 0, col);
+ drawtextn(dc, text, strlen(text), col);
 }
diff -r 1eb993cafe2a -r c6de8835d7d5 eprint.c
--- a/eprint.c Fri Jul 30 10:25:41 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-/* See LICENSE file for copyright and license details. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <draw.h>
-
-const char *progname;
-
-void
-eprint(const char *fmt, ...) {
- va_list ap;
-
- fprintf(stderr, "%s: ", progname);
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- exit(EXIT_FAILURE);
-}
diff -r 1eb993cafe2a -r c6de8835d7d5 eprintf.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/eprintf.c Sat Jul 31 14:54:11 2010 +0100
@@ -0,0 +1,18 @@
+/* See LICENSE file for copyright and license details. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <draw.h>
+
+const char *progname;
+
+void
+eprintf(const char *fmt, ...) {
+ va_list ap;
+
+ fprintf(stderr, "%s: ", progname);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
diff -r 1eb993cafe2a -r c6de8835d7d5 getcolor.c
--- a/getcolor.c Fri Jul 30 10:25:41 2010 +0100
+++ b/getcolor.c Sat Jul 31 14:54:11 2010 +0100
@@ -8,6 +8,6 @@
         XColor color;
 
         if(!XAllocNamedColor(dc->dpy, cmap, colstr, &color, &color))
- eprint("cannot allocate color '%s'\n", colstr);
+ eprintf("cannot allocate color '%s'\n", colstr);
         return color.pixel;
 }
diff -r 1eb993cafe2a -r c6de8835d7d5 initfont.c
--- a/initfont.c Fri Jul 30 10:25:41 2010 +0100
+++ b/initfont.c Sat Jul 31 14:54:11 2010 +0100
@@ -10,7 +10,7 @@
         int i, n;
 
         if(!fontstr || !*fontstr)
- eprint("cannot load null font\n");
+ eprintf("cannot load null font\n");
         dc->font.set = XCreateFontSet(dc->dpy, fontstr, &missing, &n, &def);
         if(missing)
                 XFreeStringList(missing);
@@ -28,7 +28,7 @@
         else {
                 if(!(dc->font.xfont = XLoadQueryFont(dc->dpy, fontstr))
                 && !(dc->font.xfont = XLoadQueryFont(dc->dpy, "fixed")))
- eprint("cannot load font '%s'\n", fontstr);
+ eprintf("cannot load font '%s'\n", fontstr);
                 dc->font.ascent = dc->font.xfont->ascent;
                 dc->font.descent = dc->font.xfont->descent;
         }
diff -r 1eb993cafe2a -r c6de8835d7d5 setupdraw.c
--- a/setupdraw.c Fri Jul 30 10:25:41 2010 +0100
+++ b/setupdraw.c Sat Jul 31 14:54:11 2010 +0100
@@ -7,7 +7,7 @@
         XWindowAttributes wa;
 
         if(!XGetWindowAttributes(dc->dpy, w, &wa))
- eprint("cannot get window attributes");
+ eprintf("cannot get window attributes");
         dc->drawable = XCreatePixmap(dc->dpy, w, wa.width, wa.height,
                 DefaultDepth(dc->dpy, DefaultScreen(dc->dpy)));
         dc->gc = XCreateGC(dc->dpy, w, 0, NULL);
diff -r 1eb993cafe2a -r c6de8835d7d5 textnw.c
--- a/textnw.c Fri Jul 30 10:25:41 2010 +0100
+++ b/textnw.c Sat Jul 31 14:54:11 2010 +0100
@@ -4,9 +4,9 @@
 
 int
 textnw(DC *dc, const char *text, size_t len) {
- XRectangle r;
+ if(dc->font.set) {
+ XRectangle r;
 
- if(dc->font.set) {
                 XmbTextExtents(dc->font.set, text, len, NULL, &r);
                 return r.width;
         }
Received on Sat Jul 31 2010 - 15:54:15 CEST

This archive was generated by hypermail 2.2.0 : Sat Jul 31 2010 - 16:00:07 CEST