Fix up TODO: c++0x, update cpplint.
Needed to update cpplint to handle const auto.
Fixed a few cpplint errors that were being missed before.
Replaced most of the TODO c++0x with ranged based loops. Loops which
do not have a descriptive container name have a concrete type instead
of auto.
Change-Id: Id7cc0f27030f56057c544e94277300b3f298c9c5
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 852dd00..460e3b0 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -538,12 +538,12 @@
void Dump(std::ostream& os) const {
bool first = true;
- for (It it = libraries_.begin(); it != libraries_.end(); ++it) {
+ for (const auto& library : libraries_) {
if (!first) {
os << ' ';
}
first = false;
- os << it->first;
+ os << library.first;
}
}
@@ -552,7 +552,7 @@
}
SharedLibrary* Get(const std::string& path) {
- It it = libraries_.find(path);
+ auto it = libraries_.find(path);
return (it == libraries_.end()) ? NULL : it->second;
}
@@ -566,8 +566,8 @@
std::string jni_short_name(JniShortName(m));
std::string jni_long_name(JniLongName(m));
const ClassLoader* declaring_class_loader = m->GetDeclaringClass()->GetClassLoader();
- for (It it = libraries_.begin(); it != libraries_.end(); ++it) {
- SharedLibrary* library = it->second;
+ for (const auto& lib : libraries_) {
+ SharedLibrary* library = lib.second;
if (library->GetClassLoader() != declaring_class_loader) {
// We only search libraries loaded by the appropriate ClassLoader.
continue;
@@ -591,8 +591,6 @@
}
private:
- typedef SafeMap<std::string, SharedLibrary*>::const_iterator It; // TODO: C++0x auto
-
SafeMap<std::string, SharedLibrary*> libraries_;
};