diff --git a/src/debug_utils.cc b/src/debug_utils.cc index a601c5ecf40ea9..aa97bfbe943bab 100644 --- a/src/debug_utils.cc +++ b/src/debug_utils.cc @@ -377,7 +377,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { [](struct dl_phdr_info* info, size_t size, void* data) { auto list = static_cast*>(data); if (*info->dlpi_name != '\0') { - list->push_back(info->dlpi_name); + list->emplace_back(info->dlpi_name); } return 0; }, @@ -386,7 +386,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { uint32_t i = 0; for (const char* name = _dyld_get_image_name(i); name != nullptr; name = _dyld_get_image_name(++i)) { - list.push_back(name); + list.emplace_back(name); } #elif _AIX @@ -411,10 +411,10 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { strlen(cur_info->ldinfo_filename) + 1; if (*member_name != '\0') { str << cur_info->ldinfo_filename << "(" << member_name << ")"; - list.push_back(str.str()); + list.emplace_back(str.str()); str.str(""); } else { - list.push_back(cur_info->ldinfo_filename); + list.emplace_back(cur_info->ldinfo_filename); } buf += cur_info->ldinfo_next; } while (cur_info->ldinfo_next != 0); @@ -424,7 +424,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { if (dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &p) != -1) { for (Link_map* l = p; l != nullptr; l = l->l_next) { - list.push_back(l->l_name); + list.emplace_back(l->l_name); } } @@ -459,7 +459,7 @@ std::vector NativeSymbolDebuggingContext::GetLoadedLibraries() { char* str = new char[size]; WideCharToMultiByte( CP_UTF8, 0, module_name, -1, str, size, nullptr, nullptr); - list.push_back(str); + list.emplace_back(str); } } }