Fix clang-tidy hicpp-use-emplace warnings in args parsing
This commit is contained in:
+2
-2
@@ -243,10 +243,10 @@ static std::vector<std::vector<std::string>> get_params(int argc, char* argv[])
|
||||
if ((arg.size() > 2) && (arg[0] == '-') && (arg[1] == '-')) {
|
||||
// Store the parameter name without the "--" prefix
|
||||
arg.remove_prefix(2);
|
||||
args.emplace_back(std::vector<std::string>(1, std::string(arg)));
|
||||
args.emplace_back().emplace_back(arg);
|
||||
}
|
||||
else if (!args.empty()) {
|
||||
args.back().emplace_back(std::string(arg));
|
||||
args.back().emplace_back(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1073,7 +1073,7 @@ std::vector<std::vector<std::string>> parse_config(const std::string& file_name)
|
||||
case BEFORE_NAME:
|
||||
if (is_alpha(c)) {
|
||||
state = NAME;
|
||||
args.emplace_back(std::vector<std::string>(1, std::string(1, c)));
|
||||
args.emplace_back().emplace_back(1, c);
|
||||
}
|
||||
else if (c == '#') {
|
||||
state = COMMENT;
|
||||
@@ -1103,10 +1103,10 @@ std::vector<std::vector<std::string>> parse_config(const std::string& file_name)
|
||||
state = VALUE;
|
||||
quoted = (c == '"');
|
||||
if (quoted) {
|
||||
args.back().emplace_back(std::string());
|
||||
args.back().emplace_back();
|
||||
}
|
||||
else {
|
||||
args.back().emplace_back(std::string(1, c));
|
||||
args.back().emplace_back(1, c);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user