Skip to content

Commit

Permalink
Simplify parser
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 14, 2025
1 parent 682d58b commit 3a6af0d
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions cpp/s2p/s2p_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,9 @@ vector<char*> S2pParser::ConvertLegacyOptions(const span<char*> &initial_args)
// -hd|-HD -> -h
// -idn:u|-hdn:u -> -i|-h n:u
vector<char*> args;
for (const string arg : initial_args) {
int start_of_ids = -1;
for (int i = 0; i < static_cast<int>(arg.length()); ++i) {
if (isdigit(arg[i])) {
start_of_ids = i;
break;
}
}

const string &ids = start_of_ids != -1 ? arg.substr(start_of_ids) : "";
for (const string &arg : initial_args) {
const size_t start_of_ids = arg.find_first_of("0123456789");
const string &ids = (start_of_ids != string::npos) ? arg.substr(start_of_ids) : "";

const string &arg_lower = ToLower(arg);
if (arg_lower.starts_with("-h") || arg_lower.starts_with("-i")) {
Expand Down

0 comments on commit 3a6af0d

Please sign in to comment.