Code

Merge remote branches 'jn/cosmetics', 'jn/doxygen' and 'jn/renames'
[ncmpc.git] / src / command.c
index 68b8d1e09dcea819d9c27a2619672eb501d37a1e..0e7e5a2551b2f348088a6875a60ac77b79fabf17 100644 (file)
@@ -1,21 +1,21 @@
 /* ncmpc (Ncurses MPD Client)
  * (c) 2004-2010 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
-
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
-
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
-
+ *
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
+ */
 
 #include "command.h"
 #include "config.h"
@@ -482,23 +482,20 @@ 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;
 
-               for(j=0; j<MAX_COMMAND_KEYS; j++)
+               for(j=0; j<MAX_COMMAND_KEYS; j++) {
                        if (cp[i].keys[j] &&
                            (cmd = find_key_command(cp[i].keys[j],cp)) != cp[i].command) {
                                if (buf) {
@@ -519,8 +516,9 @@ check_key_bindings(command_definition_t *cp, char *buf, size_t bufsize)
                                set_key_flags(cp, cmd, COMMAND_KEY_CONFLICT);
                                retval = -1;
                        }
-               i++;
+               }
        }
+
        return retval;
 }