]> git.tdb.fi Git - builder.git/commitdiff
Use auto type for iterator variables
authorMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 14:02:38 +0000 (16:02 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 17:19:09 +0000 (19:19 +0200)
source/architecture.h
source/binarycomponent.cpp
source/builder.cpp
source/buildgraph.cpp
source/buildinfo.cpp
source/cache.cpp
source/config.cpp
source/gnulinker.cpp
source/packagemanager.cpp
source/sourcepackage.cpp
source/virtualfilesystem.cpp

index 360f3dd9f6321919df742d4fa7992ffbce0f9e27..5b894b1ee740d14f891b73d8ffee55701407d709 100644 (file)
@@ -71,7 +71,7 @@ private:
 template<typename T>
 inline const Architecture::PatternList &Architecture::get_patterns() const
 {
-       std::map<std::string, PatternList>::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;
 
index 2cd6f853ca42db8472e7c4193c1e5f633d5f605f..816b38573e79bfb4970808b438c8ff67458d0132 100644 (file)
@@ -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) &&
index 5475c7dab99aaa6baf610ec6a6a3529d21b0b5bc..ceb7db3581f7db02915b8433fdfda56532657811 100644 (file)
@@ -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;
 }
index a3af685dd9b9cd88ce81d328c744999df0e18027..46c0c4855ae02544cac7e8fee47e471b969da914 100644 (file)
@@ -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;
index 48b4832bba1139e8209651fa37b97ec5d02a31d9..29254489cf5e6c4b8e747e2ad59cd554492c1a0f 100644 (file)
@@ -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)
index b8c71afc6744d7ef886c8483dabaa9d3f7410612..61a4cb4e6d6f9657f22e5a2b458f6ddfdd989234 100644 (file)
@@ -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);
index 3e862ecf0b7c221bf0ee4e5a160266da6b6e7356..a0603cfafc21fba7777a899de24a3c5bcffaa198 100644 (file)
@@ -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)
index c592cc86cf1e7bd888eefa753957f5988bea2e0b..4048f1c5fefbe362b2dc0e358475cad70bd4b024 100644 (file)
@@ -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++");
                }
index f54606f42f1639e09b0e91e11a2b02ecbfd15593..54cd550d062b9fc4014bf706e854e98e31d8b72f 100644 (file)
@@ -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;
                }
index 8c535e72192d8dd8dae16b5989f70b3faa4367f6..4d680ba9bd234e5d16e62ea76adda82bf8a89c2e 100644 (file)
@@ -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);
        }
index 935600de085f6409a157a0303e68b7f39c168da1..0c3ee36ec830e09864ea6416b113109c15b5ff3f 100644 (file)
@@ -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<FileTarget *>(i->second);
        return 0;