Skip to content

Commit b718ea6

Browse files
committed
[clang-tidy] fix performance issues
Found with performance* Signed-off-by: Rosen Penev <rosenp@gmail.com>
1 parent 954fd15 commit b718ea6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/jsontestrunner/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ static void printValueTree(FILE* fout, Json::Value& value,
111111
Json::Value::Members members(value.getMemberNames());
112112
std::sort(members.begin(), members.end());
113113
Json::String suffix = *(path.end() - 1) == '.' ? "" : ".";
114-
for (auto name : members) {
115-
printValueTree(fout, value[name], path + suffix + name);
114+
for (const auto& name : members) {
115+
printValueTree(fout, value[name], path + suffix.append(name));
116116
}
117117
} break;
118118
default:

src/test_lib_json/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,11 +3286,11 @@ struct CharReaderAllowDropNullTest : JsonTest::TestCase {
32863286
return [=](const Value& root) { JSONTEST_ASSERT_EQUAL(root, v); };
32873287
}
32883288

3289-
static ValueCheck objGetAnd(std::string idx, ValueCheck f) {
3289+
static ValueCheck objGetAnd(const std::string& idx, const ValueCheck& f) {
32903290
return [=](const Value& root) { f(root.get(idx, true)); };
32913291
}
32923292

3293-
static ValueCheck arrGetAnd(int idx, ValueCheck f) {
3293+
static ValueCheck arrGetAnd(int idx, const ValueCheck& f) {
32943294
return [=](const Value& root) { f(root[idx]); };
32953295
}
32963296
};

0 commit comments

Comments
 (0)