aboutsummaryrefslogtreecommitdiffstats
path: root/src/io.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/io.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/io.c')
-rw-r--r--src/io.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/io.c b/src/io.c
index 144ef67..c1b3631 100644
--- a/src/io.c
+++ b/src/io.c
@@ -531,8 +531,9 @@ void io_load_app(void)
} else if (c == '}') {
while ((c = getc(data_file)) == ' ') ;
ungetc(c, data_file);
- } else
+ } else {
io_load_error(path_apts, line, _("syntax error in item repetition"));
+ }
} else if (c == '!') { /* endless item with exceptions */
ungetc(c, data_file);
recur_exc_scan(&exc, data_file);
@@ -544,8 +545,9 @@ void io_load_app(void)
_("wrong format in the appointment or event"));
/* NOTREACHED */
}
- } else
+ } else {
ungetc(c, data_file);
+ }
/* Check if a note is attached to the item. */
c = getc(data_file);
@@ -571,8 +573,9 @@ void io_load_app(void)
state = 0L;
while ((c = getc(data_file)) == ' ') ;
ungetc(c, data_file);
- } else
+ } else {
io_load_error(path_apts, line, _("syntax error in item repetition"));
+ }
if (is_recursive) {
recur_apoint_scan(data_file, start, end,
type, freq, until, notep, &exc, state);
@@ -610,9 +613,9 @@ void io_load_todo(void)
for (;;) {
line++;
c = getc(data_file);
- if (c == EOF)
+ if (c == EOF) {
break;
- else if (c == '[') { /* new style with id */
+ } else if (c == '[') { /* new style with id */
if (fscanf(data_file, " %d ", &id) != 1 || getc(data_file) != ']')
io_load_error(path_todo, line, _("syntax error in item identifier"));
while ((c = getc(data_file)) == ' ') ;
@@ -623,9 +626,9 @@ void io_load_todo(void)
}
/* Now read the attached note, if any. */
c = getc(data_file);
- if (c == '>')
+ if (c == '>') {
note_read(note, data_file);
- else {
+ } else {
note[0] = '\0';
ungetc(c, data_file);
}
@@ -772,8 +775,9 @@ void io_load_keys(const char *pager)
(void)snprintf(already_assigned, BUFSIZ,
_("\"%s\" assigned multiple times!"), key_ch);
io_log_print(log, line, already_assigned);
- } else
+ } else {
assigned++;
+ }
}
p += strlen(key_ch) + 1;
} else {
@@ -826,8 +830,7 @@ unsigned io_file_exist(const char *file)
if (file && (fd = fopen(file, "r")) != NULL) {
fclose(fd);
return 1;
- }
- else {
+ } else {
return 0;
}
}
@@ -1163,8 +1166,9 @@ void io_set_lock(void)
fclose(lock);
if (kill(pid, 0) != 0 && errno == ESRCH)
lock = NULL;
- } else
+ } else {
fclose(lock);
+ }
}
if (lock != NULL) {
@@ -1264,8 +1268,9 @@ int io_file_cp(const char *src, const char *dst)
if (bytes_read > 0) {
if (fwrite(buffer, 1, bytes_read, fp_dst) != bytes_read)
return 0;
- } else
+ } else {
return 0;
+ }
}
fclose(fp_dst);