Fix braces in if-else statements

From the Linux kernel coding guidelines:

    Do not unnecessarily use braces where a single statement will do.
    [...] This does not apply if one branch of a conditional statement
    is a single statement. Use braces in both branches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer
2013-02-17 09:01:46 +01:00
parent 8e16853201
commit a363cb9b91
20 changed files with 172 additions and 132 deletions

View File

@@ -275,8 +275,9 @@ static int config_parse_input_datefmt(void *dummy, const char *val)
if (conf.input_datefmt <= 0 || conf.input_datefmt > DATE_FORMATS)
conf.input_datefmt = 1;
return 1;
} else
} else {
return 0;
}
}
/* Set a configuration variable. */
@@ -359,16 +360,16 @@ static void config_color_theme_name(char *theme_name)
"white"
};
if (!colorize)
if (!colorize) {
strncpy(theme_name, "none", BUFSIZ);
else {
} else {
pair_content(COLR_CUSTOM, &color[0], &color[1]);
for (i = 0; i < NBCOLORS; i++) {
if ((color[i] == DEFAULTCOLOR) || (color[i] == DEFAULTCOLOR_EXT))
if ((color[i] == DEFAULTCOLOR) || (color[i] == DEFAULTCOLOR_EXT)) {
color_name[i] = default_color;
else if (color[i] >= 0 && color[i] <= MAXCOLORS)
} else if (color[i] >= 0 && color[i] <= MAXCOLORS) {
color_name[i] = name[color[i]];
else {
} else {
EXIT(_("unknown color"));
/* NOTREACHED */
}
@@ -453,8 +454,9 @@ config_serialize_conf(char *buf, const char *key,
if (status)
status->done[i] = 1;
return 1;
} else
} else {
return 0;
}
}
}
@@ -489,8 +491,7 @@ config_file_walk(config_fn_walk_cb_t fn_cb,
if (value) {
*value = '\0';
value++;
}
else {
} else {
EXIT(_("invalid configuration directive: \"%s\""), e_conf);
}
@@ -538,12 +539,13 @@ static int config_load_cb(const char *key, const char *value, void *dummy)
{
int result = config_set_conf(key, value);
if (result < 0)
if (result < 0) {
EXIT(_("configuration variable unknown: \"%s\""), key);
/* NOTREACHED */
else if (result == 0)
/* NOTREACHED */
} else if (result == 0) {
EXIT(_("wrong configuration variable format for \"%s\""), key);
/* NOTREACHED */
/* NOTREACHED */
}
return 1;
}
@@ -560,12 +562,13 @@ static int config_save_cb(const char *key, const char *value, void *status)
int result =
config_serialize_conf(buf, key, (struct config_save_status *)status);
if (result < 0)
if (result < 0) {
EXIT(_("configuration variable unknown: \"%s\""), key);
/* NOTREACHED */
else if (result == 0)
/* NOTREACHED */
} else if (result == 0) {
EXIT(_("wrong configuration variable format for \"%s\""), key);
/* NOTREACHED */
/* NOTREACHED */
}
fputs(key, ((struct config_save_status *)status)->fp);
fputc('=', ((struct config_save_status *)status)->fp);