Skip to content
Snippets Groups Projects
Commit 79b7ceff authored by dx's avatar dx
Browse files

style(config): lightly flatten the loops of load_config

Mostly changing things like if { ... return} else { ... } to not have
an extra indentation level of the else part.

The diff is probably very weird even with stripped whitespace.
parent 51d40ee1
Branches
No related tags found
No related merge requests found
......@@ -293,7 +293,8 @@ void load_config(void)
*eol = '\0';
doline(line, eol, lineNumber);
line = eol + 1;
} else {
continue;
}
if (line == buf) {
//line did not fit into buf
LOG_WARN(
......@@ -302,7 +303,7 @@ void load_config(void)
lineNumber
);
return;
} else {
}
int seek_back = last_eol - nread;
LOG_DEBUG(
"card10.cfg",
......@@ -312,24 +313,18 @@ void load_config(void)
seek_back
);
assert(seek_back <= 0);
if (seek_back) {
int rc = epic_file_seek(
fd,
seek_back,
SEEK_CUR
);
if (!seek_back) {
break;
}
int rc = epic_file_seek(fd, seek_back, SEEK_CUR);
if (rc < 0) {
LOG_ERR("card10.cfg",
"seek failed, aborting");
LOG_ERR("card10.cfg", "seek failed, aborting");
return;
}
char newline;
rc = epic_file_read(
fd, &newline, 1
);
rc = epic_file_read(fd, &newline, 1);
if (rc < 0 || newline != '\n') {
LOG_ERR("card10.cfg",
"seek failed, aborting");
LOG_ERR("card10.cfg", "seek failed, aborting");
LOG_DEBUG(
"card10.cfg",
"seek failed at read-back of newline: rc: %d read: %d",
......@@ -338,11 +333,8 @@ void load_config(void)
);
return;
}
}
break;
}
}
}
} while (nread == sizeof(buf));
epic_file_close(fd);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment