diff options
-rw-r--r-- | evspy-core.c | 4 | ||||
-rw-r--r-- | evspy-core.h | 4 | ||||
-rw-r--r-- | khm/khm.c | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/evspy-core.c b/evspy-core.c index ec41f1e..b33fd27 100644 --- a/evspy-core.c +++ b/evspy-core.c @@ -187,11 +187,9 @@ static void evspy_event(struct input_handle *handle, unsigned int type, } else if (code == KEY_BACKSPACE && value == EVS_VAL_PRESS) { evs_backspace(); return; - } // Special/unknown keys (alt, ctrl, esc, shift, etc) - if (unlikely(code >= sizeof(map)) || - (map[code] == '.' && likely(code != KEY_DOT))) { + } else if (code >= sizeof(map) || (map[code] == '.' && likely(code != KEY_DOT))) { special_char(code, value); // "Immediate" keys (alphanumeric + some symbols) diff --git a/evspy-core.h b/evspy-core.h index 6cbe913..eec489c 100644 --- a/evspy-core.h +++ b/evspy-core.h @@ -92,8 +92,8 @@ */ #define evs_delete() \ ({ \ - if (wrp != rdp && evs_decp(wrp) == rdp) \ - evs_decp(rdp); \ + if (likely(wrp != rdp)) \ + evs_decp(wrp); \ }) /* @@ -65,7 +65,7 @@ inline struct khashmap *khm_create(void) struct khashmap *head; head = kmalloc(sizeof(struct khashmap), GFP_KERNEL); - if (!head) + if (unlikely(!head)) return NULL; INIT_LIST_HEAD(&head->l); @@ -102,7 +102,7 @@ int khm_insert(struct khashmap *head, int value, void *data) return -EINVAL; new = khm_create(); - if (!new) + if (unlikely(!new)) return -ENOMEM; new->value = value; |