Fix perf counter argument parsing (#1160)

* Fix argument order in StrSplit

* Update AUTHORS, CONTRIBUTORS
This commit is contained in:
Norman Heino 2021-06-01 16:50:42 +02:00 committed by GitHub
parent 4ff734960c
commit 6f094ba13e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 3 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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));

View File

@ -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