]> git.tdb.fi Git - builder.git/commitdiff
Use shortcut functions for find calls
authorMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 12:52:33 +0000 (14:52 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 19 Dec 2022 17:19:08 +0000 (19:19 +0200)
source/binarypackage.cpp
source/component.cpp
source/objectfile.cpp
source/sourcearchivecomponent.cpp
source/sourcepackage.cpp
source/target.cpp
source/tool.cpp
source/vssolutionfile.cpp

index 2c32d87769a76a48f7ce9a2bb2a5414486b42ff3..02b9be21d7b58966a323ea66f295af14f0158d7f 100644 (file)
@@ -1,4 +1,4 @@
-#include <algorithm>
+#include <msp/core/algorithm.h>
 #include <msp/io/print.h>
 #include <msp/strings/utils.h>
 #include "binarypackage.h"
@@ -24,7 +24,7 @@ BinaryPackage *BinaryPackage::from_flags(Builder &builder, const string &name, c
 
        Flags exclusive_static_flags;
        for(const string &f: static_flags)
-               if(find(flags.begin(), flags.end(), f)==flags.end())
+               if(!any_equals(flags, f))
                        exclusive_static_flags.push_back(f);
        process_flags(exclusive_static_flags, pkg->static_binfo);
 
index 0e183b5fc8039e509a0fecc87e9f4f66a8a138f5..963625122005f7fdff8837ba5372deaf0cd4f02a 100644 (file)
@@ -35,12 +35,12 @@ void Component::create_build_info()
        for(Package *r: all_reqs)
        {
                BuildInfo::UpdateLevel level = BuildInfo::CHAINED;
-               if(find(direct_reqs.begin(), direct_reqs.end(), r)!=direct_reqs.end())
+               if(any_equals(direct_reqs, r))
                        level = BuildInfo::DEPENDENCY;
                final_build_info.update_from(r->get_exported_build_info(), level);
 
                for(Package *q: r->get_required_packages())
-                       if(find(all_reqs.begin(), all_reqs.end(), q)==all_reqs.end())
+                       if(!any_equals(all_reqs, q))
                                all_reqs.push_back(q);
        }
 
index f78686e3bd999d2bff52ad5c27b53fe367c6fc88..256807c1d7930d7db3e1c6e6360d5d6ceb1f26f7 100644 (file)
@@ -103,7 +103,7 @@ void ObjectFile::find_dependencies(FileTarget *tgt)
        }
 
        for(Target *d: deps_to_add)
-               if(find(depends.begin(), depends.end(), d)==depends.end())
+               if(!any_equals(depends, d))
                {
                        add_dependency(*d);
                        if(d->get_real_target()->is_buildable())
index fdf82e53bafb1a966fe56db064d0dfba9f3ef6ff..027debcf2881200ad536fdd9a2d8be81c6989886 100644 (file)
@@ -1,4 +1,4 @@
-#include <algorithm>
+#include <msp/core/algorithm.h>
 #include "builder.h"
 #include "file.h"
 #include "sourcearchivecomponent.h"
@@ -30,7 +30,7 @@ void SourceArchiveComponent::create_targets() const
        BuildGraph &build_graph = builder.get_build_graph();
        for(const auto &kvp: build_graph.get_targets())
                if(kvp.second->get_package()==&package && !kvp.second->is_buildable())
-                       if(find(files.begin(), files.end(), kvp.second)==files.end())
+                       if(!any_equals(files, kvp.second))
                                files.push_back(kvp.second);
 
        const Toolchain &toolchain = builder.get_toolchain();
index a89feb245c7c13ad50f4ad72920202ba328caed2..8c535e72192d8dd8dae16b5989f70b3faa4367f6 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.begin(), obj.components.end(), obj.source_archive);
+       ComponentList::iterator i = find(obj.components, obj.source_archive);
        if(i!=obj.components.end())
                obj.components.splice(obj.components.end(), obj.components, i);
 }
index 49a769371739044f8ae3200198273979391c15ad..b741705e4d34193276e8c642c344668a45f45ecd 100644 (file)
@@ -1,4 +1,4 @@
-#include <algorithm>
+#include <msp/core/algorithm.h>
 #include <msp/fs/stat.h>
 #include <msp/fs/utils.h>
 #include <msp/strings/format.h>
@@ -62,7 +62,7 @@ Target *Target::get_buildable_target()
        for(Target *d: depends)
        {
                // Avoid infinite recursion if a target repends on its own side effect
-               if(find(side_effects.begin(), side_effects.end(), d)!=side_effects.end())
+               if(any_equals(side_effects, d))
                        continue;
 
                Target *tgt = d->get_buildable_target();
index 496132f7a5266523e92777e0558aeb79b62b57cb..44255a1eb5ca692fe1fc03461cd63e4d422eca61 100644 (file)
@@ -1,4 +1,4 @@
-#include <algorithm>
+#include <msp/core/algorithm.h>
 #include <msp/strings/format.h>
 #include "architecture.h"
 #include "builder.h"
@@ -38,12 +38,7 @@ void Tool::set_command(const string &cmd, bool cross)
 
 bool Tool::accepts_suffix(const string &suffix, bool aux) const
 {
-       if(find(input_suffixes.begin(), input_suffixes.end(), suffix)!=input_suffixes.end())
-               return true;
-       else if(aux)
-               return find(aux_suffixes.begin(), aux_suffixes.end(), suffix)!=aux_suffixes.end();
-       else
-               return false;
+       return (any_equals(input_suffixes, suffix) || (aux && any_equals(aux_suffixes, suffix)));
 }
 
 Target *Tool::create_target(Target &source, const string &arg)
index c667fc5b245dd2fa4fad60a16a1ab3c5be696b0e..af7e01ff016cbdac5e0833d126857f5b927987a5 100644 (file)
@@ -25,7 +25,7 @@ void VsSolutionFile::find_dependencies()
                                add_dependency(*project);
 
                        for(Package *r: spkg->get_required_packages())
-                               if(find(reqs, r)==reqs.end())
+                               if(!any_equals(reqs, r))
                                        reqs.push_back(r);
                }
 }