From: Daniel Carl Date: Tue, 16 Oct 2012 20:51:55 +0000 (+0200) Subject: Use g_list_prepend in keybind. X-Git-Url: https://git.owens.tech/assets/favicon.png/assets/favicon.png/git?a=commitdiff_plain;h=3491d10463bcc16b1e2d93f1fcfef145dd7f847f;p=vimb.git Use g_list_prepend in keybind. This leads to a better performance. --- diff --git a/src/keybind.c b/src/keybind.c index 270d66b..5b52b4c 100644 --- a/src/keybind.c +++ b/src/keybind.c @@ -25,7 +25,7 @@ void keybind_add(int mode, guint modkey, guint modmask, guint keyval, const gcha keybind->keyval = keyval; keybind->command = g_strdup(command); - keys = g_slist_append(keys, keybind); + keys = g_slist_prepend(keys, keybind); /* save the modkey also in the modkey string */ if (modkey) { @@ -48,10 +48,10 @@ GSList* keybind_find(int mode, guint modkey, guint modmask, guint keyval) for (link = keys; link != NULL; link = link->next) { Keybind* keybind = (Keybind*)link->data; - if (keybind->mode == mode + if (keybind->keyval == keyval && keybind->modmask == modmask && keybind->modkey == modkey - && keybind->keyval == keyval) { + && keybind->mode == mode) { return link; } }