mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 06:25:34 +00:00
[3516] Added some comments in processFile() for loop
This commit is contained in:
@@ -524,27 +524,33 @@ void processFile(const std::string& filename)
|
|||||||
LinesType lines1;
|
LinesType lines1;
|
||||||
for (LinesType::iterator l = lines0.begin(); l != lines0.end(); ++l) {
|
for (LinesType::iterator l = lines0.begin(); l != lines0.end(); ++l) {
|
||||||
std::string line = *l;
|
std::string line = *l;
|
||||||
|
// Empty lines have no spaces so are processed
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
lines1.push_back(line);
|
lines1.push_back(line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Trim leading spaces
|
||||||
size_t start = line.find_first_not_of(" \t\r\n\t\v");
|
size_t start = line.find_first_not_of(" \t\r\n\t\v");
|
||||||
if (start != 0) {
|
if (start != 0) {
|
||||||
line.erase(0, start);
|
line.erase(0, start);
|
||||||
}
|
}
|
||||||
|
// Done?
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
lines1.push_back(line);
|
lines1.push_back(line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Trim trailing spaces
|
||||||
size_t finish = line.find_last_not_of(" \t\r\n\t\v");
|
size_t finish = line.find_last_not_of(" \t\r\n\t\v");
|
||||||
if ((finish != std::string::npos) &&
|
if ((finish != std::string::npos) &&
|
||||||
(finish + 1 != line.size())) {
|
(finish + 1 != line.size())) {
|
||||||
line.erase(finish + 1);
|
line.erase(finish + 1);
|
||||||
}
|
}
|
||||||
|
// Done
|
||||||
if (line.empty()) {
|
if (line.empty()) {
|
||||||
lines1.push_back(line);
|
lines1.push_back(line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Skip comments
|
||||||
if (line[0] != '#') {
|
if (line[0] != '#') {
|
||||||
lines1.push_back(line);
|
lines1.push_back(line);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user