aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2013-02-17 09:01:46 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2013-02-17 09:19:04 +0100
commita363cb9b9111aed22d105adb0e7a8e9caab9bbe3 (patch)
treeb0be8fac73932dcde5b40d6f8cee777f501d869c /src/config.c
parent8e16853201f8a608905cacbf1c7e4fb8ac7e568e (diff)
downloadcalcurse-a363cb9b9111aed22d105adb0e7a8e9caab9bbe3.tar.gz
calcurse-a363cb9b9111aed22d105adb0e7a8e9caab9bbe3.zip
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>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/config.c b/src/config.c
index 72ce7fa..083b9cf 100644
--- a/src/config.c
+++ b/src/config.c
@@ -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);