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

* commit 'df62e3171ca52cbdadb3c3edc93c42cfacbad054':
  Use const auto& in for loops.
This commit is contained in:
Elliott Hughes 2015-10-03 16:35:32 +00:00 committed by Android Git Automerger
commit 8daf53db75
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; sigquit_flag = false;
// Print current running tests. // Print current running tests.
printf("List of current running tests:\n"); 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) { if (child_proc.pid != 0) {
std::string test_name = testcase_list[child_proc.testcase_id].GetTestName(child_proc.test_id); std::string test_name = testcase_list[child_proc.testcase_id].GetTestName(child_proc.test_id);
int64_t current_time_ns = NanoTime(); int64_t current_time_ns = NanoTime();
@ -646,7 +646,7 @@ static void HandleSignals(std::vector<TestCase>& testcase_list,
} else if (sigint_flag) { } else if (sigint_flag) {
sigint_flag = false; sigint_flag = false;
// Kill current running tests. // Kill current running tests.
for (auto& child_proc : child_proc_list) { for (const auto& child_proc : child_proc_list) {
if (child_proc.pid != 0) { if (child_proc.pid != 0) {
// Send SIGKILL to ensure the child process can be killed unconditionally. // Send SIGKILL to ensure the child process can be killed unconditionally.
kill(child_proc.pid, SIGKILL); kill(child_proc.pid, SIGKILL);

View File

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

View File

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