diff options
| author | Herman Semenoff <GermanAizek@yandex.ru> | 2026-04-08 11:51:08 +0300 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-04-08 10:40:55 +0000 |
| commit | ef70431f02e2ec13ecedab7ac342574e52d1877b (patch) | |
| tree | de51c6f3ce74d0b7fd1ddacd0812cd1cbe116c14 /apt-pkg/deb | |
| parent | 5b649fb72ecdced056fb3daab02e88933cc7a32a (diff) | |
apt: push to emplace C++11 if possible
References:
- https://www.reddit.com/r/cpp_questions/comments/pm63yx/why_clangtidy_says_use_emplace_back_instead_of/
- https://clang.llvm.org/extra/clang-tidy/checks/modernize/use-emplace.html
Diffstat (limited to 'apt-pkg/deb')
| -rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 395227f50..0f1d407b7 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -266,12 +266,12 @@ bool pkgDPkgPM::Configure(PkgIterator Pkg) if (Pkg.end() == true) return false; - List.push_back(Item(Item::Configure, Pkg)); + List.emplace_back(Item::Configure, Pkg); // Use triggers for config calls if we configure "smart" // as otherwise Pre-Depends will not be satisfied, see #526774 if (_config->FindB("DPkg::TriggersPending", false) == true) - List.push_back(Item(Item::TriggersPending, PkgIterator())); + List.emplace_back(Item::TriggersPending, PkgIterator()); return true; } @@ -285,9 +285,9 @@ bool pkgDPkgPM::Remove(PkgIterator Pkg,bool Purge) return false; if (Purge == true) - List.push_back(Item(Item::Purge,Pkg)); + List.emplace_back(Item::Purge,Pkg); else - List.push_back(Item(Item::Remove,Pkg)); + List.emplace_back(Item::Remove,Pkg); return true; } /*}}}*/ @@ -2328,10 +2328,10 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg) // do not report dpkg I/O errors, this is a format string, so we compare // the prefix and the suffix of the error with the dpkg error message vector<string> io_errors; - io_errors.push_back(string("failed to read")); - io_errors.push_back(string("failed to write")); - io_errors.push_back(string("failed to seek")); - io_errors.push_back(string("unexpected end of file or stream")); + io_errors.emplace_back("failed to read"); + io_errors.emplace_back("failed to write"); + io_errors.emplace_back("failed to seek"); + io_errors.emplace_back("unexpected end of file or stream"); for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); ++I) { |
