Re: [dwm] [patch] simplification to drawtext

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sun, 1 Jun 2008 18:59:20 +0200

On Sun, Jun 01, 2008 at 01:21:03PM +0200, Premysl Hruby wrote:
> Not much readable (because it firstly looks like it's error (buf maybe
> not ended with \0)). I am against using strncpy in case that dest string
> is not C string, but char[] + length.
>
> Maybe:
>
> memcpy(&buf[MAX(0, len - 3)], "...", 3);
>
> would be somewhat better ;)
>
>
> > XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
> > if(dc.font.set)
> > XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);

I though a while about this, and I think the memcpy() idea is
best.

Kind regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Sun Jun 01 2008 - 18:59:20 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:46:40 UTC