From efcaa4e34f37d4f6317468dbe737b5cd9ef33ff0 Mon Sep 17 00:00:00 2001 From: DarrenJiang13 Date: Fri, 19 Jan 2024 10:42:22 +0800 Subject: [PATCH] replace erase() with clear() to make imported keylist deconstruction faster --- obj_gen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/obj_gen.cpp b/obj_gen.cpp index d5a02b4c..e7d51302 100644 --- a/obj_gen.cpp +++ b/obj_gen.cpp @@ -529,10 +529,10 @@ imported_keylist::imported_keylist(const char *filename) imported_keylist::~imported_keylist() { - while (!m_keys.empty()) { - free(m_keys.front()); - m_keys.erase(m_keys.begin()); + for (unsigned int i = 0; i < m_keys.size(); i++) { + free(m_keys[i]); } + m_keys.clear(); } bool imported_keylist::read_keys(void)