Code

command.c: use for instead of while in check_key_bindings
authorJonathan Neuschäfer <j.neuschaefer@gmx.net>
Tue, 22 Nov 2011 22:09:35 +0000 (23:09 +0100)
committerMax Kellermann <max@duempel.org>
Fri, 2 Dec 2011 11:08:34 +0000 (12:08 +0100)
src/command.c

index 67e0ad3b11a22a0181076fb0aa488dadf8d57403..2b586174c415d8f83666692c389d72ec4f13c793 100644 (file)
@@ -482,19 +482,16 @@ assign_keys(command_t command, int keys[MAX_COMMAND_KEYS])
 int
 check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize)
 {
-       int i = 0;
+       int i;
        int retval = 0;
 
        if (cp == NULL)
                cp = cmds;
 
-       while (cp[i].name) {
+       for (i = 0; cp[i].name; i++)
                cp[i].flags &= ~COMMAND_KEY_CONFLICT;
-               i++;
-       }
 
-       i = 0;
-       while (cp[i].name) {
+       for (i = 0; cp[i].name; i++) {
                int j;
                command_t cmd;
 
@@ -520,8 +517,8 @@ check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize)
                                retval = -1;
                        }
                }
-               i++;
        }
+
        return retval;
 }