Skip to content

Commit

Permalink
Fix perf counter argument parsing (google#1160)
Browse files Browse the repository at this point in the history
* Fix argument order in StrSplit

* Update AUTHORS, CONTRIBUTORS
  • Loading branch information
0xfeedface authored and vincenzopalazzo committed Feb 8, 2022
1 parent 5503ac1 commit 8c603f3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Matt Clarkson <mattyclarkson@gmail.com>
Maxim Vafin <maxvafin@gmail.com>
MongoDB Inc.
Nick Hutchinson <nshutchinson@gmail.com>
Norman Heino <norman.heino@gmail.com>
Oleksandr Sochka <sasha.sochka@gmail.com>
Ori Livneh <ori.livneh@gmail.com>
Paul Redmond <paul.redmond@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Lei Xu <eddyxu@gmail.com>
Matt Clarkson <mattyclarkson@gmail.com>
Maxim Vafin <maxvafin@gmail.com>
Nick Hutchinson <nshutchinson@gmail.com>
Norman Heino <norman.heino@gmail.com>
Oleksandr Sochka <sasha.sochka@gmail.com>
Ori Livneh <ori.livneh@gmail.com>
Pascal Leroy <phl@google.com>
Expand Down
2 changes: 1 addition & 1 deletion src/string_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ std::vector<std::string> StrSplit(const std::string& str, char delim) {
size_t first = 0;
size_t next = str.find(delim);
for (; next != std::string::npos;
first = next + 1, next = str.find(first, delim)) {
first = next + 1, next = str.find(delim, first)) {
ret.push_back(str.substr(first, next - first));
}
ret.push_back(str.substr(first));
Expand Down
4 changes: 2 additions & 2 deletions test/string_util_gtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ TEST(StringUtilTest, StrSplit) {
EXPECT_EQ(benchmark::StrSplit("", ','), std::vector<std::string>{});
EXPECT_EQ(benchmark::StrSplit("hello", ','),
std::vector<std::string>({"hello"}));
EXPECT_EQ(benchmark::StrSplit("hello,there", ','),
std::vector<std::string>({"hello", "there"}));
EXPECT_EQ(benchmark::StrSplit("hello,there,is,more", ','),
std::vector<std::string>({"hello", "there", "is", "more"}));
}

} // end namespace

0 comments on commit 8c603f3

Please sign in to comment.