diff --git a/lib/tty/key.c b/lib/tty/key.c index a24ef56d8..a77141b35 100644 --- a/lib/tty/key.c +++ b/lib/tty/key.c @@ -1471,10 +1471,10 @@ lookup_key (const char *name, char **label) return 0; name = g_strstrip (g_strdup (name)); - p = lc_keys = g_strsplit_set (name, "-+ ", -1); + lc_keys = g_strsplit_set (name, "-+ ", -1); g_free ((char *) name); - while ((p != NULL) && (*p != NULL)) + for (p = lc_keys; p != NULL && *p != NULL; p++) { if ((*p)[0] != '\0') { @@ -1495,8 +1495,6 @@ lookup_key (const char *name, char **label) break; } } - - p++; } g_strfreev (lc_keys); @@ -1505,7 +1503,6 @@ lookup_key (const char *name, char **label) if (k <= 0) return 0; - if (label != NULL) { GString *s;