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
No related branches found
No related tags found
No related merge requests found
...@@ -293,7 +293,8 @@ void load_config(void) ...@@ -293,7 +293,8 @@ void load_config(void)
*eol = '\0'; *eol = '\0';
doline(line, eol, lineNumber); doline(line, eol, lineNumber);
line = eol + 1; line = eol + 1;
} else { continue;
}
if (line == buf) { if (line == buf) {
//line did not fit into buf //line did not fit into buf
LOG_WARN( LOG_WARN(
...@@ -302,7 +303,7 @@ void load_config(void) ...@@ -302,7 +303,7 @@ void load_config(void)
lineNumber lineNumber
); );
return; return;
} else { }
int seek_back = last_eol - nread; int seek_back = last_eol - nread;
LOG_DEBUG( LOG_DEBUG(
"card10.cfg", "card10.cfg",
...@@ -312,24 +313,18 @@ void load_config(void) ...@@ -312,24 +313,18 @@ void load_config(void)
seek_back seek_back
); );
assert(seek_back <= 0); assert(seek_back <= 0);
if (seek_back) { if (!seek_back) {
int rc = epic_file_seek( break;
fd, }
seek_back, int rc = epic_file_seek(fd, seek_back, SEEK_CUR);
SEEK_CUR
);
if (rc < 0) { if (rc < 0) {
LOG_ERR("card10.cfg", LOG_ERR("card10.cfg", "seek failed, aborting");
"seek failed, aborting");
return; return;
} }
char newline; char newline;
rc = epic_file_read( rc = epic_file_read(fd, &newline, 1);
fd, &newline, 1
);
if (rc < 0 || newline != '\n') { if (rc < 0 || newline != '\n') {
LOG_ERR("card10.cfg", LOG_ERR("card10.cfg", "seek failed, aborting");
"seek failed, aborting");
LOG_DEBUG( LOG_DEBUG(
"card10.cfg", "card10.cfg",
"seek failed at read-back of newline: rc: %d read: %d", "seek failed at read-back of newline: rc: %d read: %d",
...@@ -338,11 +333,8 @@ void load_config(void) ...@@ -338,11 +333,8 @@ void load_config(void)
); );
return; return;
} }
}
break; break;
} }
}
}
} while (nread == sizeof(buf)); } while (nread == sizeof(buf));
epic_file_close(fd); 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