--- st.h | 4 ---- x.c | 22 +++++++--------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/st.h b/st.h index 8cdacfe..c58f0ad 100644 --- a/st.h +++ b/st.h _AT_@ -268,15 +268,11 @@ extern unsigned int mousefg; extern unsigned int mousebg; extern unsigned int defaultattr; extern MouseShortcut mshortcuts[]; -extern size_t mshortcutslen; extern Shortcut shortcuts[]; -extern size_t shortcutslen; extern KeySym mappedkeys[]; -extern size_t mappedkeyslen; extern Key key[]; extern size_t keylen; extern uint ignoremod; extern uint forceselmod; extern uint selmasks[]; -extern size_t selmaskslen; extern char ascii_printable[]; diff --git a/x.c b/x.c index 4bac345..ba2c162 100644 --- a/x.c +++ b/x.c _AT_@ -192,14 +192,6 @@ static double defaultfontsize = 0; static int oldbutton = 3; /* button event on startup: 3 = release */ -/* config.h array lengths */ -size_t colornamelen = LEN(colorname); -size_t mshortcutslen = LEN(mshortcuts); -size_t shortcutslen = LEN(shortcuts); -size_t mappedkeyslen = LEN(mappedkeys); -size_t keylen = LEN(key); -size_t selmaskslen = LEN(selmasks); - int x2col(int x) { _AT_@ -248,7 +240,7 @@ getbuttoninfo(XEvent *e) selnormalize(); sel.type = SEL_REGULAR; - for (type = 1; type < selmaskslen; ++type) { + for (type = 1; type < LEN(selmasks); ++type) { if (match(selmasks[type], state)) { sel.type = type; break; _AT_@ -331,7 +323,7 @@ bpress(XEvent *e) return; } - for (ms = mshortcuts; ms < mshortcuts + mshortcutslen; ms++) { + for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { if (e->xbutton.button == ms->b && match(ms->mask, e->xbutton.state)) { ttysend(ms->s, strlen(ms->s)); _AT_@ -721,7 +713,7 @@ xloadcols(void) static int loaded; Color *cp; - dc.collen = MAX(colornamelen, 256); + dc.collen = MAX(LEN(colorname), 256); dc.col = xmalloc(dc.collen * sizeof(Color)); if (loaded) { _AT_@ -1682,7 +1674,7 @@ kpress(XEvent *ev) len = XmbLookupString(xw.xic, e, buf, sizeof buf, &ksym, &status); /* 1. shortcuts */ - for (bp = shortcuts; bp < shortcuts + shortcutslen; bp++) { + for (bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) { if (ksym == bp->keysym && match(bp->mod, e->state)) { bp->func(&(bp->arg)); return; _AT_@ -1758,16 +1750,16 @@ kmap(KeySym k, uint state) int i; /* Check for mapped keys out of X11 function keys. */ - for (i = 0; i < mappedkeyslen; i++) { + for (i = 0; i < LEN(mappedkeys); i++) { if (mappedkeys[i] == k) break; } - if (i == mappedkeyslen) { + if (i == LEN(mappedkeys)) { if ((k & 0xFFFF) < 0xFD00) return NULL; } - for (kp = key; kp < key + keylen; kp++) { + for (kp = key; kp < key + LEN(key); kp++) { if (kp->k != k) continue; -- 2.14.1Received on Sun Sep 24 2017 - 23:11:40 CEST
This archive was generated by hypermail 2.3.0 : Sun Sep 24 2017 - 23:25:51 CEST