From 690b9c5f340504517cf6ba8aad0c168dcdff4efa Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 19 Dec 2022 16:02:38 +0200 Subject: [PATCH] Use auto type for iterator variables --- source/architecture.h | 2 +- source/binarycomponent.cpp | 2 +- source/builder.cpp | 2 +- source/buildgraph.cpp | 2 +- source/buildinfo.cpp | 4 ++-- source/cache.cpp | 2 +- source/config.cpp | 4 ++-- source/gnulinker.cpp | 2 +- source/packagemanager.cpp | 6 +++--- source/sourcepackage.cpp | 4 ++-- source/virtualfilesystem.cpp | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/architecture.h b/source/architecture.h index 360f3dd..5b894b1 100644 --- a/source/architecture.h +++ b/source/architecture.h @@ -71,7 +71,7 @@ private: template inline const Architecture::PatternList &Architecture::get_patterns() const { - std::map::const_iterator i = filename_patterns.find(typeid(T).name()); + auto i = filename_patterns.find(typeid(T).name()); if(i!=filename_patterns.end()) return i->second; diff --git a/source/binarycomponent.cpp b/source/binarycomponent.cpp index 2cd6f85..816b385 100644 --- a/source/binarycomponent.cpp +++ b/source/binarycomponent.cpp @@ -70,7 +70,7 @@ void BinaryComponent::create_targets() const if(processing_unit!=Tool::ONE_FILE) { FS::Path source_dir = FS::dirname(*i); - SourceList::iterator j = i; + auto j = i; for(++j; j!=source_filenames.end(); ) { if((processing_unit!=Tool::DIRECTORY || FS::dirname(*j)==source_dir) && diff --git a/source/builder.cpp b/source/builder.cpp index 5475c7d..ceb7db3 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -324,7 +324,7 @@ void Builder::Loader::build_type(const string &n) { BuildType btype(n); load_sub(btype); - BuildTypeMap::iterator i = obj.build_types.insert(BuildTypeMap::value_type(n, btype)).first; + auto i = obj.build_types.insert(BuildTypeMap::value_type(n, btype)).first; if(!obj.build_type) obj.build_type = &i->second; } diff --git a/source/buildgraph.cpp b/source/buildgraph.cpp index a3af685..46c0c48 100644 --- a/source/buildgraph.cpp +++ b/source/buildgraph.cpp @@ -25,7 +25,7 @@ BuildGraph::~BuildGraph() Target *BuildGraph::get_target(const string &n) const { - TargetMap::const_iterator i = targets.find(n); + auto i = targets.find(n); if(i!=targets.end()) return i->second; return 0; diff --git a/source/buildinfo.cpp b/source/buildinfo.cpp index 48b4832..2925448 100644 --- a/source/buildinfo.cpp +++ b/source/buildinfo.cpp @@ -39,7 +39,7 @@ BuildInfo::BuildInfo(): BuildInfo::LibraryMode BuildInfo::get_libmode_for(const string &lib) const { - LibModeMap::const_iterator i = libmodes.find(lib); + auto i = libmodes.find(lib); if(i!=libmodes.end()) return i->second; return libmode; @@ -54,7 +54,7 @@ void BuildInfo::update_from(const BuildInfo &bi, UpdateLevel level) for(const auto &kvp: bi.standards) { - StandardMap::iterator j = standards.find(kvp.first); + auto j = standards.find(kvp.first); if(j==standards.end()) standards.insert(kvp); else if(kvp.second.type!=j->second.type || kvp.second.year!=j->second.year) diff --git a/source/cache.cpp b/source/cache.cpp index b8c71af..61a4cb4 100644 --- a/source/cache.cpp +++ b/source/cache.cpp @@ -73,7 +73,7 @@ void Cache::set_value(const Target *tgt, const string &k, const string &v) void Cache::append_value(const Target *tgt, const string &k, const string &v) { Key key(tgt->get_name(), k); - DataMap::iterator i = data.find(key); + auto i = data.find(key); if(i==data.end()) i = data.insert(DataMap::value_type(key, ValueList())).first; i->second.push_back(v); diff --git a/source/config.cpp b/source/config.cpp index 3e862ec..a0603cf 100644 --- a/source/config.cpp +++ b/source/config.cpp @@ -19,7 +19,7 @@ Config::Config(SourcePackage &p): const Config::Option &Config::add_option(const Feature &f) { Option opt(f); - InputOptions::const_iterator i = pending_options.find(opt.name); + auto i = pending_options.find(opt.name); if(i!=pending_options.end()) opt.value = i->second; @@ -30,7 +30,7 @@ bool Config::set_option(const string &opt, const string &val) { bool result = false; - OptionMap::iterator i = options.find(opt); + auto i = options.find(opt); if(i!=options.end()) { if(i->second.value!=val) diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index c592cc8..4048f1c 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -337,7 +337,7 @@ Task *GnuLinker::Linker::run(const Target &target) const { if(compiler_tag=="CXX") { - BuildInfo::LibModeMap::const_iterator i = binfo.libmodes.find("stdc++"); + auto i = binfo.libmodes.find("stdc++"); if(i!=binfo.libmodes.end() && i->second<=BuildInfo::STATIC) argv.push_back("-static-libstdc++"); } diff --git a/source/packagemanager.cpp b/source/packagemanager.cpp index f54606f..54cd550 100644 --- a/source/packagemanager.cpp +++ b/source/packagemanager.cpp @@ -47,7 +47,7 @@ void PackageManager::set_no_externals(bool x) void PackageManager::add_package(Package *pkg) { - PackageMap::iterator i = packages.find(pkg->get_name()); + auto i = packages.find(pkg->get_name()); if(i!=packages.end()) { if(i->second!=pkg) @@ -64,7 +64,7 @@ void PackageManager::add_package(Package *pkg) Package *PackageManager::get_package(const string &name) const { - PackageMap::const_iterator i = packages.find(name); + auto i = packages.find(name); if(i!=packages.end()) return i->second; @@ -92,7 +92,7 @@ Package *PackageManager::find_package(const string &name) if(!path.empty()) { builder.load_build_file(path/"Build"); - PackageMap::iterator i = packages.find(name); + auto i = packages.find(name); if(i!=packages.end()) return i->second; } diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index 8c535e7..4d680ba 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -205,7 +205,7 @@ void SourcePackage::Loader::finish() { /* Make sure the source tarball is last in the list so targets from all other components wil be created first */ - ComponentList::iterator i = find(obj.components, obj.source_archive); + auto i = find(obj.components, obj.source_archive); if(i!=obj.components.end()) obj.components.splice(obj.components.end(), obj.components, i); } @@ -220,7 +220,7 @@ void SourcePackage::Loader::feature(const string &n, const string &d) const Config::Option &opt = obj.config.add_option(feat); if(options) { - Config::InputOptions::const_iterator i = options->find(opt.name); + auto i = options->find(opt.name); if(i!=options->end()) obj.config.set_option(opt.name, i->second); } diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index 935600d..0c3ee36 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -22,7 +22,7 @@ VirtualFileSystem::VirtualFileSystem(Builder &b): FileTarget *VirtualFileSystem::get_target(const FS::Path &p) const { - TargetMap::const_iterator i = targets.find(p.str()); + auto i = targets.find(p.str()); if(i!=targets.end()) return static_cast(i->second); return 0; -- 2.45.2