Use LEN(dc.col) instead of LEN(colorname).
authornoname@inventati.org <noname@inventati.org>
Sun, 19 Apr 2015 20:24:44 +0000 (22:24 +0200)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Tue, 21 Apr 2015 06:13:46 +0000 (08:13 +0200)
LEN(colorname) may be below 256 for some configurations.

st.c

diff --git a/st.c b/st.c
index c805117..7f08748 100644 (file)
--- a/st.c
+++ b/st.c
@@ -2911,7 +2911,7 @@ xloadcols(void) {
        }
 
        /* load colors [0-15] and [256-LEN(colorname)] (config.h) */
-       for(i = 0; i < LEN(colorname); i++) {
+       for(i = 0; i < LEN(dc.col); i++) {
                if(!colorname[i])
                        continue;
                if(!XftColorAllocName(xw.dpy, xw.vis, xw.cmap, colorname[i], &dc.col[i])) {
@@ -2942,7 +2942,7 @@ xsetcolorname(int x, const char *name) {
        XRenderColor color = { .alpha = 0xffff };
        Color ncolor;
 
-       if(!BETWEEN(x, 0, LEN(colorname)))
+       if(!BETWEEN(x, 0, LEN(dc.col)))
                return 1;
 
        if(!name) {