]> granicus.if.org Git - icinga2/commitdiff
Replace boost::ref/boost::cref with std::ref/std::cref
authorGunnar Beutner <gunnar.beutner@icinga.com>
Thu, 23 Nov 2017 05:51:48 +0000 (06:51 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Thu, 30 Nov 2017 16:47:09 +0000 (17:47 +0100)
18 files changed:
lib/base/scriptutils.cpp
lib/base/threadpool.cpp
lib/base/utility.cpp
lib/cli/consolecommand.cpp
lib/cli/daemonutility.cpp
lib/cli/featureutility.cpp
lib/cli/troubleshootcommand.cpp
lib/config/configcompiler.cpp
lib/icinga/icingaapplication.cpp
lib/icinga/macroprocessor.cpp
lib/livestatus/livestatuslogutility.cpp
lib/livestatus/table.cpp
lib/remote/apilistener-filesync.cpp
lib/remote/apilistener.cpp
lib/remote/configpackageutility.cpp
lib/remote/filterutility.cpp
lib/remote/httprequest.cpp
lib/remote/httpresponse.cpp

index a35db87c39872f032500136d36e708fd9f30941c..e3a1b64a7005ae792c71c51b52bbf4e699e53325 100644 (file)
@@ -477,7 +477,7 @@ Value ScriptUtils::Glob(const std::vector<Value>& args)
                type = args[1];
 
        std::vector<String> paths;
-       Utility::Glob(pathSpec, std::bind(&GlobCallbackHelper, boost::ref(paths), _1), type);
+       Utility::Glob(pathSpec, std::bind(&GlobCallbackHelper, std::ref(paths), _1), type);
 
        return Array::FromVector(paths);
 }
@@ -496,7 +496,7 @@ Value ScriptUtils::GlobRecursive(const std::vector<Value>& args)
                type = args[2];
 
        std::vector<String> paths;
-       Utility::GlobRecursive(path, pattern, std::bind(&GlobCallbackHelper, boost::ref(paths), _1), type);
+       Utility::GlobRecursive(path, pattern, std::bind(&GlobCallbackHelper, std::ref(paths), _1), type);
 
        return Array::FromVector(paths);
 }
index df5152d6085e6ec40b0cd7367d1eca602c1145c3..8b9b4705c4550a88b0979b5fb5734ab44b3bc787 100644 (file)
@@ -23,7 +23,6 @@
 #include "base/utility.hpp"
 #include "base/exception.hpp"
 #include "base/application.hpp"
-#include <boost/bind.hpp>
 #include <iostream>
 
 using namespace icinga;
@@ -337,7 +336,7 @@ void ThreadPool::Queue::SpawnWorker(boost::thread_group& group)
                        Log(LogDebug, "ThreadPool", "Spawning worker thread.");
 
                        Threads[i] = WorkerThread(ThreadIdle);
-                       Threads[i].Thread = group.create_thread(boost::bind(&ThreadPool::WorkerThread::ThreadProc, boost::ref(Threads[i]), boost::ref(*this)));
+                       Threads[i].Thread = group.create_thread(std::bind(&ThreadPool::WorkerThread::ThreadProc, std::ref(Threads[i]), std::ref(*this)));
 
                        break;
                }
index 02238f7120b453f128801b4823982a3c2567c431..ce6aa572dc9717855fe0370a0180ae78728db442 100644 (file)
@@ -770,7 +770,7 @@ void Utility::MkDirP(const String& path, int mode)
 void Utility::RemoveDirRecursive(const String& path)
 {
        std::vector<String> paths;
-       Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, boost::ref(paths)), GlobFile | GlobDirectory);
+       Utility::GlobRecursive(path, "*", std::bind(&Utility::CollectPaths, _1, std::ref(paths)), GlobFile | GlobDirectory);
 
        /* This relies on the fact that GlobRecursive lists the parent directory
           first before recursing into subdirectories. */
index 55b836eb30eb5d4c3f95c79a0c5746732df4e405..89cb892bc5564cec0d8d79e2e50f8cd9c2f2b8df 100644 (file)
@@ -196,9 +196,9 @@ char *ConsoleCommand::ConsoleCompleteHelper(const char *word, int state)
 
                        l_ApiClient->AutocompleteScript(l_Session, word, l_ScriptFrame->Sandboxed,
                            std::bind(&ConsoleCommand::AutocompleteScriptCompletionHandler,
-                           boost::ref(mutex), boost::ref(cv), boost::ref(ready),
+                           std::ref(mutex), std::ref(cv), std::ref(ready),
                            _1, _2,
-                           boost::ref(suggestions)));
+                           std::ref(suggestions)));
 
                        {
                                boost::mutex::scoped_lock lock(mutex);
@@ -426,9 +426,9 @@ incomplete:
 
                                l_ApiClient->ExecuteScript(l_Session, command, scriptFrame.Sandboxed,
                                    std::bind(&ConsoleCommand::ExecuteScriptCompletionHandler,
-                                   boost::ref(mutex), boost::ref(cv), boost::ref(ready),
+                                   std::ref(mutex), std::ref(cv), std::ref(ready),
                                    _1, _2,
-                                   boost::ref(result), boost::ref(eptr)));
+                                   std::ref(result), std::ref(eptr)));
 
                                {
                                        boost::mutex::scoped_lock lock(mutex);
index 903cca03f95db2d0b247c16f741caf5c19016994..d9c9ff67d5654209ce546d5770e2fbb59465d147 100644 (file)
@@ -52,7 +52,7 @@ static void IncludeZoneDirRecursive(const String& path, const String& package, b
        ConfigCompiler::RegisterZoneDir("_etc", path, zoneName);
 
        std::vector<Expression *> expressions;
-       Utility::GlobRecursive(path, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
+       Utility::GlobRecursive(path, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zoneName, package), GlobFile);
        DictExpression expr(expressions);
        if (!ExecuteExpression(&expr))
                success = false;
@@ -75,7 +75,7 @@ static void IncludeNonLocalZone(const String& zonePath, const String& package, b
        }
 
        std::vector<Expression *> expressions;
-       Utility::GlobRecursive(zonePath, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
+       Utility::GlobRecursive(zonePath, "*.conf", std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zoneName, package), GlobFile);
        DictExpression expr(expressions);
        if (!ExecuteExpression(&expr))
                success = false;
@@ -126,7 +126,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
 
        String zonesEtcDir = Application::GetZonesDir();
        if (!zonesEtcDir.IsEmpty() && Utility::PathExists(zonesEtcDir))
-               Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", boost::ref(success)), GlobDirectory);
+               Utility::Glob(zonesEtcDir + "/*", std::bind(&IncludeZoneDirRecursive, _1, "_etc", std::ref(success)), GlobDirectory);
 
        if (!success)
                return false;
@@ -135,7 +135,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
         * are authoritative on this node and are checked in HasZoneConfigAuthority(). */
        String packagesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/packages";
        if (Utility::PathExists(packagesVarDir))
-               Utility::Glob(packagesVarDir + "/*", std::bind(&IncludePackage, _1, boost::ref(success)), GlobDirectory);
+               Utility::Glob(packagesVarDir + "/*", std::bind(&IncludePackage, _1, std::ref(success)), GlobDirectory);
 
        if (!success)
                return false;
@@ -143,7 +143,7 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
        /* Load cluster synchronized configuration files */
        String zonesVarDir = Application::GetLocalStateDir() + "/lib/icinga2/api/zones";
        if (Utility::PathExists(zonesVarDir))
-               Utility::Glob(zonesVarDir + "/*", std::bind(&IncludeNonLocalZone, _1, "_cluster", boost::ref(success)), GlobDirectory);
+               Utility::Glob(zonesVarDir + "/*", std::bind(&IncludeNonLocalZone, _1, "_cluster", std::ref(success)), GlobDirectory);
 
        if (!success)
                return false;
index 4b4b9df8e9a206e7988ff597e357d1f72ff285a5..296d8fba7bd959b9d45753e3c9a14b604f7c054f 100644 (file)
@@ -200,11 +200,11 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
                /* disable = available-enabled */
                String available_pattern = GetFeaturesAvailablePath() + "/*.conf";
                std::vector<String> available;
-               Utility::Glob(available_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(available)), GlobFile);
+               Utility::Glob(available_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, std::ref(available)), GlobFile);
 
                String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
                std::vector<String> enabled;
-               Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(enabled)), GlobFile);
+               Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, std::ref(enabled)), GlobFile);
 
                std::sort(available.begin(), available.end());
                std::sort(enabled.begin(), enabled.end());
@@ -217,7 +217,7 @@ bool FeatureUtility::GetFeatures(std::vector<String>& features, bool get_disable
                /* all enabled features */
                String enabled_pattern = GetFeaturesEnabledPath() + "/*.conf";
 
-               Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, boost::ref(features)), GlobFile);
+               Utility::Glob(enabled_pattern, std::bind(&FeatureUtility::CollectFeatures, _1, std::ref(features)), GlobFile);
        }
 
        return true;
index 01ae8644b1179454c315ab1c1350b39b5654b12e..a8e5d4b4276ca7fb9a09a6701f73367d8429ab00 100644 (file)
@@ -375,8 +375,8 @@ bool TroubleshootCommand::PrintCrashReports(InfoLog& log)
        String bestFilename;
 
        try {
-               Utility::Glob(spath, std::bind(&GetLatestReport, _1, boost::ref(bestTimestamp),
-                   boost::ref(bestFilename)), GlobFile);
+               Utility::Glob(spath, std::bind(&GetLatestReport, _1, std::ref(bestTimestamp),
+                   std::ref(bestFilename)), GlobFile);
        }
 #ifdef _WIN32
        catch (win32_error &ex) {
index f1bec5c912950bb990c87d6b7c021ab55a98f298..dbb6c0c01969bc72b2b529fad5441694ae732b5b 100644 (file)
@@ -155,7 +155,7 @@ Expression *ConfigCompiler::HandleInclude(const String& relativeBase, const Stri
 
        std::vector<Expression *> expressions;
 
-       if (!Utility::Glob(includePath, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile) && includePath.FindFirstOf("*?") == String::NPos) {
+       if (!Utility::Glob(includePath, std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zone, package), GlobFile) && includePath.FindFirstOf("*?") == String::NPos) {
                std::ostringstream msgbuf;
                msgbuf << "Include file '" + path + "' does not exist";
                BOOST_THROW_EXCEPTION(ScriptError(msgbuf.str(), debuginfo));
@@ -185,7 +185,7 @@ Expression *ConfigCompiler::HandleIncludeRecursive(const String& relativeBase, c
                ppath = relativeBase + "/" + path;
 
        std::vector<Expression *> expressions;
-       Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zone, package), GlobFile);
+       Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zone, package), GlobFile);
 
        DictExpression *dict = new DictExpression(expressions);
        dict->MakeInline();
@@ -205,7 +205,7 @@ void ConfigCompiler::HandleIncludeZone(const String& relativeBase, const String&
 
        RegisterZoneDir(tag, ppath, zoneName);
 
-       Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, boost::ref(expressions), _1, zoneName, package), GlobFile);
+       Utility::GlobRecursive(ppath, pattern, std::bind(&ConfigCompiler::CollectIncludes, std::ref(expressions), _1, zoneName, package), GlobFile);
 }
 
 /**
@@ -231,7 +231,7 @@ Expression *ConfigCompiler::HandleIncludeZones(const String& relativeBase, const
        }
 
        std::vector<Expression *> expressions;
-       Utility::Glob(ppath + "/*", std::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, boost::ref(expressions)), GlobDirectory);
+       Utility::Glob(ppath + "/*", std::bind(&ConfigCompiler::HandleIncludeZone, newRelativeBase, tag, _1, pattern, package, std::ref(expressions)), GlobDirectory);
        return new DictExpression(expressions);
 }
 
index 74a4a4c8d70549c7b5fd517d87122cc1b4ffa089..86b5d82f19c4d40099c14b2f215babf90ab504fc 100644 (file)
@@ -166,7 +166,7 @@ void IcingaApplication::DumpModifiedAttributes(void)
        fp.exceptions(std::ofstream::failbit | std::ofstream::badbit);
 
        ConfigObject::Ptr previousObject;
-       ConfigObject::DumpModifiedAttributes(std::bind(&PersistModAttrHelper, boost::ref(fp), boost::ref(previousObject), _1, _2, _3));
+       ConfigObject::DumpModifiedAttributes(std::bind(&PersistModAttrHelper, std::ref(fp), std::ref(previousObject), _1, _2, _3));
 
        if (previousObject) {
                ConfigWriter::EmitRaw(fp, "\tobj.version = ");
index c7755df27b7221c1db1e08d1afa3a10e41c13b8f..c97bd1b67af11e05079198b95fbb50c75a5b1a19 100644 (file)
@@ -216,10 +216,10 @@ Value MacroProcessor::EvaluateFunction(const Function::Ptr& func, const Resolver
        }
 
        resolvers_this->Set("macro", new Function("macro (temporary)", std::bind(&MacroProcessor::InternalResolveMacrosShim,
-           _1, boost::cref(resolvers), cr, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros,
+           _1, std::cref(resolvers), cr, MacroProcessor::EscapeCallback(), resolvedMacros, useResolvedMacros,
            recursionLevel + 1), { "str" }));
        resolvers_this->Set("resolve_arguments", new Function("resolve_arguments (temporary)", std::bind(&MacroProcessor::InternalResolveArgumentsShim,
-           _1, boost::cref(resolvers), cr, resolvedMacros, useResolvedMacros,
+           _1, std::cref(resolvers), cr, resolvedMacros, useResolvedMacros,
            recursionLevel + 1)));
 
        std::vector<Value> args;
index 21570cf94620ebdf5739ef936bce706dc97aa53f..768c80c96b306fe55c78e3087f7b222526a99c9b 100644 (file)
@@ -39,8 +39,8 @@ using namespace icinga;
 
 void LivestatusLogUtility::CreateLogIndex(const String& path, std::map<time_t, String>& index)
 {
-       Utility::Glob(path + "/icinga.log", std::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
-       Utility::Glob(path + "/archives/*.log", std::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, boost::ref(index)), GlobFile);
+       Utility::Glob(path + "/icinga.log", std::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, std::ref(index)), GlobFile);
+       Utility::Glob(path + "/archives/*.log", std::bind(&LivestatusLogUtility::CreateLogIndexFileHandler, _1, std::ref(index)), GlobFile);
 }
 
 void LivestatusLogUtility::CreateLogIndexFileHandler(const String& path, std::map<time_t, String>& index)
index 7e04b21c0af3bc8912a05123e20a13afb9aefce2..34659f18c25d2ec44c064e7f6e5466e486e3705f 100644 (file)
@@ -128,7 +128,7 @@ std::vector<LivestatusRowValue> Table::FilterRows(const Filter::Ptr& filter, int
 {
        std::vector<LivestatusRowValue> rs;
 
-       FetchRows(std::bind(&Table::FilteredAddRow, this, boost::ref(rs), filter, limit, _1, _2, _3));
+       FetchRows(std::bind(&Table::FilteredAddRow, this, std::ref(rs), filter, limit, _1, _2, _3));
 
        return rs;
 }
index 7dd5e4502890f4a86d80db3c1cb3e77b3f9605a8..0c16e3c9f8463fb6960a9b06cc87e7238cf59196 100644 (file)
@@ -72,7 +72,7 @@ ConfigDirInformation ApiListener::LoadConfigDir(const String& dir)
        ConfigDirInformation config;
        config.UpdateV1 = new Dictionary();
        config.UpdateV2 = new Dictionary();
-       Utility::GlobRecursive(dir, "*", std::bind(&ApiListener::ConfigGlobHandler, boost::ref(config), dir, _1), GlobFile);
+       Utility::GlobRecursive(dir, "*", std::bind(&ApiListener::ConfigGlobHandler, std::ref(config), dir, _1), GlobFile);
        return config;
 }
 
index fce03dfab5b24ea3a629cb97ca88b7931b6b1147..4c3d4d06e01f9a75133e2e6919fbbb951217156a 100644 (file)
@@ -631,7 +631,7 @@ void ApiListener::ApiTimerHandler(void)
        double now = Utility::GetTime();
 
        std::vector<int> files;
-       Utility::Glob(GetApiDir() + "log/*", std::bind(&ApiListener::LogGlobHandler, boost::ref(files), _1), GlobFile);
+       Utility::Glob(GetApiDir() + "log/*", std::bind(&ApiListener::LogGlobHandler, std::ref(files), _1), GlobFile);
        std::sort(files.begin(), files.end());
 
        for (int ts : files) {
@@ -1090,7 +1090,7 @@ void ApiListener::ReplayLog(const JsonRpcConnection::Ptr& client)
                count = 0;
 
                std::vector<int> files;
-               Utility::Glob(GetApiDir() + "log/*", std::bind(&ApiListener::LogGlobHandler, boost::ref(files), _1), GlobFile);
+               Utility::Glob(GetApiDir() + "log/*", std::bind(&ApiListener::LogGlobHandler, std::ref(files), _1), GlobFile);
                std::sort(files.begin(), files.end());
 
                for (int ts : files) {
index c7a6670fa2b9276cb07b08072430f8ab86f472a9..61cf09139ef331754a2b2082127474bf0ac26759 100644 (file)
@@ -60,7 +60,7 @@ std::vector<String> ConfigPackageUtility::GetPackages(void)
 {
        std::vector<String> packages;
        Utility::Glob(GetPackageDir() + "/*", std::bind(&ConfigPackageUtility::CollectDirNames,
-           _1, boost::ref(packages)), GlobDirectory);
+           _1, std::ref(packages)), GlobDirectory);
        return packages;
 }
 
@@ -237,7 +237,7 @@ void ConfigPackageUtility::DeleteStage(const String& packageName, const String&
 std::vector<String> ConfigPackageUtility::GetStages(const String& packageName)
 {
        std::vector<String> stages;
-       Utility::Glob(GetPackageDir() + "/" + packageName + "/*", std::bind(&ConfigPackageUtility::CollectDirNames, _1, boost::ref(stages)), GlobDirectory);
+       Utility::Glob(GetPackageDir() + "/" + packageName + "/*", std::bind(&ConfigPackageUtility::CollectDirNames, _1, std::ref(stages)), GlobDirectory);
        return stages;
 }
 
@@ -263,7 +263,7 @@ String ConfigPackageUtility::GetActiveStage(const String& packageName)
 std::vector<std::pair<String, bool> > ConfigPackageUtility::GetFiles(const String& packageName, const String& stageName)
 {
        std::vector<std::pair<String, bool> > paths;
-       Utility::GlobRecursive(GetPackageDir() + "/" + packageName + "/" + stageName, "*", std::bind(&ConfigPackageUtility::CollectPaths, _1, boost::ref(paths)), GlobDirectory | GlobFile);
+       Utility::GlobRecursive(GetPackageDir() + "/" + packageName + "/" + stageName, "*", std::bind(&ConfigPackageUtility::CollectPaths, _1, std::ref(paths)), GlobDirectory | GlobFile);
 
        return paths;
 }
index 7d897745f2c5d422d459c54db1f439177258868c..b9895928d9f322f5607807cc259ccb35e3f2bd4d 100644 (file)
@@ -269,8 +269,8 @@ std::vector<Value> FilterUtility::GetFilterTargets(const QueryDescription& qd, c
 
                try {
                        provider->FindTargets(type, std::bind(&FilteredAddTarget,
-                           boost::ref(permissionFrame), permissionFilter,
-                           boost::ref(frame), ufilter, boost::ref(result), variableName, _1));
+                           std::ref(permissionFrame), permissionFilter,
+                           std::ref(frame), ufilter, std::ref(result), variableName, _1));
                } catch (const std::exception& ex) {
                        delete ufilter;
                        throw;
index d5e2e6fc1915c842e4ea371f58c34963b97ca7b4..a1be4bd459c59239202801f038d3c7a393368d2b 100644 (file)
@@ -100,7 +100,7 @@ bool HttpRequest::Parse(StreamReadContext& src, bool may_wait)
        } else if (m_State == HttpRequestBody) {
                if (Headers->Get("transfer-encoding") == "chunked") {
                        if (!m_ChunkContext)
-                               m_ChunkContext = std::make_shared<ChunkReadContext>(boost::ref(src));
+                               m_ChunkContext = std::make_shared<ChunkReadContext>(std::ref(src));
 
                        char *data;
                        size_t size;
index 870e91e73bd9eef36e8e71dc10d795e743a7153a..587b587479a90e7d868edb0de81a9217267c1094 100644 (file)
@@ -182,7 +182,7 @@ bool HttpResponse::Parse(StreamReadContext& src, bool may_wait)
        } else if (m_State == HttpResponseBody) {
                if (Headers->Get("transfer-encoding") == "chunked") {
                        if (!m_ChunkContext)
-                               m_ChunkContext = std::make_shared<ChunkReadContext>(boost::ref(src));
+                               m_ChunkContext = std::make_shared<ChunkReadContext>(std::ref(src));
 
                        char *data;
                        size_t size;