Skip to content

Commit 8ef8458

Browse files
generatedunixname2413856222380011meta-codesync[bot]
authored andcommitted
xplat/folly/test
Reviewed By: ak7 Differential Revision: D92383997 fbshipit-source-id: 52f2f73776d5cdc545234ec8510043fe76aaa0ea
1 parent 6f164a0 commit 8ef8458

2 files changed

Lines changed: 17 additions & 16 deletions

File tree

third-party/folly/src/folly/test/ConcurrentSkipListBenchmark.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ void BM_SetMerge(int iters, int size) {
118118
susp.dismiss();
119119

120120
[[maybe_unused]] int64_t mergedSum = 0;
121-
FOR_EACH (it, a_set) {
122-
if (b_set.find(*it) != b_set.end()) {
123-
mergedSum += *it;
121+
for (const auto& value : a_set) {
122+
if (b_set.find(value) != b_set.end()) {
123+
mergedSum += value;
124124
}
125125
}
126126
BENCHMARK_SUSPEND {
@@ -143,9 +143,9 @@ void BM_CSLMergeLookup(int iters, int size) {
143143
susp.dismiss();
144144

145145
SkipListType::Skipper skipper(skipList2);
146-
FOR_EACH (it, skipList) {
147-
if (skipper.to(*it)) {
148-
mergedSum += *it;
146+
for (const auto& value : skipList) {
147+
if (skipper.to(value)) {
148+
mergedSum += value;
149149
}
150150
}
151151

@@ -390,8 +390,9 @@ class ConcurrentAccessData {
390390
}
391391

392392
~ConcurrentAccessData() {
393-
FOR_EACH (lock, locks_)
394-
delete *lock;
393+
for (auto* lock : locks_) {
394+
delete lock;
395+
}
395396
}
396397

397398
inline bool skipListFind(int /* idx */, ValueType val) {
@@ -501,8 +502,8 @@ void BM_ContentionCSL(int iters, int size) {
501502
for (int i = 0; i < FLAGS_num_threads; ++i) {
502503
threads.emplace_back(&ConcurrentAccessData::runSkipList, data, i, iters);
503504
}
504-
FOR_EACH (t, threads) {
505-
(*t).join();
505+
for (auto& thread : threads) {
506+
thread.join();
506507
}
507508
}
508509

@@ -515,8 +516,8 @@ void BM_ContentionStdSet(int iters, int size) {
515516
for (int i = 0; i < FLAGS_num_threads; ++i) {
516517
threads.emplace_back(&ConcurrentAccessData::runSet, data, i, iters);
517518
}
518-
FOR_EACH (t, threads) {
519-
(*t).join();
519+
for (auto& thread : threads) {
520+
thread.join();
520521
}
521522
susp.rehire();
522523
}

third-party/folly/src/folly/test/FBStringTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ template <class String>
9494
void randomString(String* toFill, unsigned int maxSize = 1000) {
9595
assert(toFill);
9696
toFill->resize(random(0, maxSize));
97-
FOR_EACH (i, *toFill) {
98-
*i = random('a', 'z');
97+
for (auto& c : *toFill) {
98+
c = random('a', 'z');
9999
}
100100
}
101101

@@ -1300,9 +1300,9 @@ sed nisl. In diam lacus, lobortis ut posuere nec, ornare id quam.";
13001300
{
13011301
istringstream input(s1);
13021302
fbstring line;
1303-
FOR_EACH (i, v) {
1303+
for (const auto& expected : v) {
13041304
EXPECT_TRUE(!getline(input, line).fail());
1305-
EXPECT_EQ(line, *i);
1305+
EXPECT_EQ(line, expected);
13061306
}
13071307
}
13081308
}

0 commit comments

Comments
 (0)