Add STLDeleteValues, and use it.
This is the version from Chromium.
Change-Id: I5b7c6a544d5d5db8244869c58461cad16e7b4b86
diff --git a/src/jni_internal.cc b/src/jni_internal.cc
index 5ab8692..292d1e4 100644
--- a/src/jni_internal.cc
+++ b/src/jni_internal.cc
@@ -20,6 +20,7 @@
#include "object.h"
#include "runtime.h"
#include "scoped_jni_thread_state.h"
+#include "stl_util.h"
#include "stringpiece.h"
#include "thread.h"
@@ -555,10 +556,7 @@
}
~Libraries() {
- // Delete our map values. (The keys will be cleaned up by the map itself.)
- for (It it = libraries_.begin(); it != libraries_.end(); ++it) {
- delete it->second;
- }
+ STLDeleteValues(&libraries_);
}
SharedLibrary* Get(const std::string& path) {