am 5c50449b: Merge "Use const auto& in for loops."

* commit '5c50449b0c098cb8191fe3f7791e91a7ec4f7029':
  Use const auto& in for loops.
This commit is contained in:
Elliott Hughes 2015-10-03 16:29:55 +00:00 committed by Android Git Automerger
commit df62e3171c
3 changed files with 10 additions and 11 deletions

View File

@ -635,7 +635,7 @@ static void HandleSignals(std::vector<TestCase>& testcase_list,
sigquit_flag = false;
// Print current running tests.
printf("List of current running tests:\n");
for (auto& child_proc : child_proc_list) {
for (const auto& child_proc : child_proc_list) {
if (child_proc.pid != 0) {
std::string test_name = testcase_list[child_proc.testcase_id].GetTestName(child_proc.test_id);
int64_t current_time_ns = NanoTime();
@ -646,7 +646,7 @@ static void HandleSignals(std::vector<TestCase>& testcase_list,
} else if (sigint_flag) {
sigint_flag = false;
// Kill current running tests.
for (auto& child_proc : child_proc_list) {
for (const auto& child_proc : child_proc_list) {
if (child_proc.pid != 0) {
// Send SIGKILL to ensure the child process can be killed unconditionally.
kill(child_proc.pid, SIGKILL);

View File

@ -70,7 +70,7 @@ TEST(pthread, pthread_key_many_distinct) {
std::vector<pthread_key_t> keys;
auto scope_guard = make_scope_guard([&keys]{
for (auto key : keys) {
for (const auto& key : keys) {
EXPECT_EQ(0, pthread_key_delete(key));
}
});
@ -108,7 +108,7 @@ TEST(pthread, pthread_key_not_exceed_PTHREAD_KEYS_MAX) {
}
// Don't leak keys.
for (auto key : keys) {
for (const auto& key : keys) {
EXPECT_EQ(0, pthread_key_delete(key));
}
keys.clear();
@ -1162,7 +1162,7 @@ TEST(pthread, pthread_attr_getstack__main_thread) {
void* maps_stack_hi = NULL;
std::vector<map_record> maps;
ASSERT_TRUE(Maps::parse_maps(&maps));
for (auto& map : maps) {
for (const auto& map : maps) {
if (map.pathname == "[stack]") {
maps_stack_hi = reinterpret_cast<void*>(map.addr_end);
break;
@ -1552,8 +1552,8 @@ class StrictAlignmentAllocator {
}
~StrictAlignmentAllocator() {
for (auto& p : allocated_array) {
delete [] p;
for (const auto& p : allocated_array) {
delete[] p;
}
}

View File

@ -832,11 +832,10 @@ TEST(unistd, get_cpu_count_from_string) {
}
TEST(unistd, sysconf_SC_NPROCESSORS_ONLN) {
std::string s;
ASSERT_TRUE(android::base::ReadFileToString("/sys/devices/system/cpu/online", &s));
std::vector<std::string> strs = android::base::Split(s, ",");
std::string line;
ASSERT_TRUE(android::base::ReadFileToString("/sys/devices/system/cpu/online", &line));
long online_cpus = 0;
for (auto& s : strs) {
for (const std::string& s : android::base::Split(line, ",")) {
std::vector<std::string> numbers = android::base::Split(s, "-");
if (numbers.size() == 1u) {
online_cpus++;