Skip to content

Commit

Permalink
Revert " Fix infinite loop in split_by_comma_or_colon(). (#1332)"
Browse files Browse the repository at this point in the history
This reverts commit 0c74e82.
  • Loading branch information
rui314 authored Aug 18, 2024
1 parent 0c74e82 commit 37f258b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/cmdline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,14 @@ static std::vector<std::string_view>
split_by_comma_or_colon(std::string_view str) {
std::vector<std::string_view> vec;

while (!str.empty()) {
for (;;) {
i64 pos = str.find_first_of(",:");
if (pos == str.npos) {
vec.push_back(str);
break;
}
if (pos > 0) {
vec.push_back(str.substr(0, pos));
}
str = str.substr(pos + 1);
vec.push_back(str.substr(0, pos));
str = str.substr(pos);
}
return vec;
}
Expand Down

0 comments on commit 37f258b

Please sign in to comment.