little style fixes for the previous patch

This commit is contained in:
Michael Stapelberg 2011-08-04 21:25:47 +02:00
parent 9d101d8473
commit 787dd4059f

View File

@ -311,24 +311,27 @@ void kill_configerror_nagbar(bool wait_for_it) {
} }
/* /*
check_for_duplicate_bindings is function looking for duplicated * Checks for duplicate key bindings (the same keycode or keysym is configured
key bindings loaded from configuration file. It goes trought all bindings * more than once). If a duplicate binding is found, a message is printed to
and tests if exists same key mapping in bindings visited before. * stderr and the has_errors variable is set to true, which will start
If exists, message is printed to "stderr" and error warning is set. * i3-nagbar.
*/ *
*/
static bool check_for_duplicate_bindings(struct context *context) { static bool check_for_duplicate_bindings(struct context *context) {
bool retval = true; bool retval = true;
Binding *bind, *current; Binding *bind, *current;
TAILQ_FOREACH(current, bindings, bindings) { TAILQ_FOREACH(current, bindings, bindings) {
bind = TAILQ_FIRST(bindings); bind = TAILQ_FIRST(bindings);
// test only bindings visited up to current binding /* test only bindings visited up to current binding */
while ((bind != TAILQ_END(bindings)) && (bind != current)) { while ((bind != TAILQ_END(bindings)) && (bind != current)) {
// testing is not case sensitive /* testing is not case sensitive */
if ((strcasecmp(bind->symbol, current->symbol) == 0) && (bind->keycode == current->keycode) && (bind->mods == current->mods)) { if ((strcasecmp(bind->symbol, current->symbol) == 0) &&
(bind->keycode == current->keycode) &&
(bind->mods == current->mods)) {
context->has_errors = true; context->has_errors = true;
fprintf(stderr, "Duplicated keybinding in config file: mod%d with key %s", current->mods, current->symbol); fprintf(stderr, "Duplicated keybinding in config file: mod%d with key %s", current->mods, current->symbol);
// if keycode is 0, it´s not necessary to print it. /* if keycode is 0, this is a keysym binding */
if(current->keycode != 0) if (current->keycode != 0)
fprintf(stderr, " and keycode %d", current->keycode); fprintf(stderr, " and keycode %d", current->keycode);
fprintf(stderr, "\n"); fprintf(stderr, "\n");
retval = false; retval = false;