fix: do not need an extra variable for a single read
[st.git] / st.c
diff --git a/st.c b/st.c
index 96111a0..16803ec 100644 (file)
--- a/st.c
+++ b/st.c
@@ -916,7 +916,6 @@ bpress(XEvent *e) {
                if(sel.snap != 0) {
                        sel.mode++;
                        tsetdirt(sel.nb.y, sel.ne.y);
-                       draw();
                }
                sel.tclick2 = sel.tclick1;
                sel.tclick1 = now;
@@ -3356,17 +3355,17 @@ focus(XEvent *ev) {
        }
 }
 
-inline bool
+static inline bool
 match(uint mask, uint state) {
-       state &= ~(ignoremod);
+       state &= ~ignoremod;
 
        if(mask == XK_NO_MOD && state)
                return false;
        if(mask != XK_ANY_MOD && mask != XK_NO_MOD && !state)
                return false;
-       if((state & mask) != state)
-               return false;
-       return true;
+       if(mask == XK_ANY_MOD)
+               return true;
+       return state == mask;
 }
 
 void
@@ -3376,7 +3375,6 @@ numlock(const Arg *dummy) {
 
 char*
 kmap(KeySym k, uint state) {
-       uint mask;
        Key *kp;
        int i;
 
@@ -3391,12 +3389,10 @@ kmap(KeySym k, uint state) {
        }
 
        for(kp = key; kp < key + LEN(key); kp++) {
-               mask = kp->mask;
-
                if(kp->k != k)
                        continue;
 
-               if(!match(mask, state))
+               if(!match(kp->mask, state))
                        continue;
 
                if(kp->appkey > 0) {