diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index a35db87c3..e3a1b64a7 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -477,7 +477,7 @@ Value ScriptUtils::Glob(const std::vector& args) type = args[1]; std::vector 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& args) type = args[2]; std::vector 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); } diff --git a/lib/base/threadpool.cpp b/lib/base/threadpool.cpp index df5152d60..8b9b4705c 100644 --- a/lib/base/threadpool.cpp +++ b/lib/base/threadpool.cpp @@ -23,7 +23,6 @@ #include "base/utility.hpp" #include "base/exception.hpp" #include "base/application.hpp" -#include #include 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; } diff --git a/lib/base/utility.cpp b/lib/base/utility.cpp index 02238f712..ce6aa572d 100644 --- a/lib/base/utility.cpp +++ b/lib/base/utility.cpp @@ -770,7 +770,7 @@ void Utility::MkDirP(const String& path, int mode) void Utility::RemoveDirRecursive(const String& path) { std::vector 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. */ diff --git a/lib/cli/consolecommand.cpp b/lib/cli/consolecommand.cpp index 55b836eb3..89cb892bc 100644 --- a/lib/cli/consolecommand.cpp +++ b/lib/cli/consolecommand.cpp @@ -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); diff --git a/lib/cli/daemonutility.cpp b/lib/cli/daemonutility.cpp index 903cca03f..d9c9ff67d 100644 --- a/lib/cli/daemonutility.cpp +++ b/lib/cli/daemonutility.cpp @@ -52,7 +52,7 @@ static void IncludeZoneDirRecursive(const String& path, const String& package, b ConfigCompiler::RegisterZoneDir("_etc", path, zoneName); std::vector 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 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& 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& 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& 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; diff --git a/lib/cli/featureutility.cpp b/lib/cli/featureutility.cpp index 4b4b9df8e..296d8fba7 100644 --- a/lib/cli/featureutility.cpp +++ b/lib/cli/featureutility.cpp @@ -200,11 +200,11 @@ bool FeatureUtility::GetFeatures(std::vector& features, bool get_disable /* disable = available-enabled */ String available_pattern = GetFeaturesAvailablePath() + "/*.conf"; std::vector 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 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& 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; diff --git a/lib/cli/troubleshootcommand.cpp b/lib/cli/troubleshootcommand.cpp index 01ae8644b..a8e5d4b42 100644 --- a/lib/cli/troubleshootcommand.cpp +++ b/lib/cli/troubleshootcommand.cpp @@ -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) { diff --git a/lib/config/configcompiler.cpp b/lib/config/configcompiler.cpp index f1bec5c91..dbb6c0c01 100644 --- a/lib/config/configcompiler.cpp +++ b/lib/config/configcompiler.cpp @@ -155,7 +155,7 @@ Expression *ConfigCompiler::HandleInclude(const String& relativeBase, const Stri std::vector 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 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 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); } diff --git a/lib/icinga/icingaapplication.cpp b/lib/icinga/icingaapplication.cpp index 74a4a4c8d..86b5d82f1 100644 --- a/lib/icinga/icingaapplication.cpp +++ b/lib/icinga/icingaapplication.cpp @@ -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 = "); diff --git a/lib/icinga/macroprocessor.cpp b/lib/icinga/macroprocessor.cpp index c7755df27..c97bd1b67 100644 --- a/lib/icinga/macroprocessor.cpp +++ b/lib/icinga/macroprocessor.cpp @@ -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 args; diff --git a/lib/livestatus/livestatuslogutility.cpp b/lib/livestatus/livestatuslogutility.cpp index 21570cf94..768c80c96 100644 --- a/lib/livestatus/livestatuslogutility.cpp +++ b/lib/livestatus/livestatuslogutility.cpp @@ -39,8 +39,8 @@ using namespace icinga; void LivestatusLogUtility::CreateLogIndex(const String& path, std::map& 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& index) diff --git a/lib/livestatus/table.cpp b/lib/livestatus/table.cpp index 7e04b21c0..34659f18c 100644 --- a/lib/livestatus/table.cpp +++ b/lib/livestatus/table.cpp @@ -128,7 +128,7 @@ std::vector Table::FilterRows(const Filter::Ptr& filter, int { std::vector 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; } diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index 7dd5e4502..0c16e3c9f 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -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; } diff --git a/lib/remote/apilistener.cpp b/lib/remote/apilistener.cpp index fce03dfab..4c3d4d06e 100644 --- a/lib/remote/apilistener.cpp +++ b/lib/remote/apilistener.cpp @@ -631,7 +631,7 @@ void ApiListener::ApiTimerHandler(void) double now = Utility::GetTime(); std::vector 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 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) { diff --git a/lib/remote/configpackageutility.cpp b/lib/remote/configpackageutility.cpp index c7a6670fa..61cf09139 100644 --- a/lib/remote/configpackageutility.cpp +++ b/lib/remote/configpackageutility.cpp @@ -60,7 +60,7 @@ std::vector ConfigPackageUtility::GetPackages(void) { std::vector 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 ConfigPackageUtility::GetStages(const String& packageName) { std::vector 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 > ConfigPackageUtility::GetFiles(const String& packageName, const String& stageName) { std::vector > 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; } diff --git a/lib/remote/filterutility.cpp b/lib/remote/filterutility.cpp index 7d897745f..b9895928d 100644 --- a/lib/remote/filterutility.cpp +++ b/lib/remote/filterutility.cpp @@ -269,8 +269,8 @@ std::vector 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; diff --git a/lib/remote/httprequest.cpp b/lib/remote/httprequest.cpp index d5e2e6fc1..a1be4bd45 100644 --- a/lib/remote/httprequest.cpp +++ b/lib/remote/httprequest.cpp @@ -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(boost::ref(src)); + m_ChunkContext = std::make_shared(std::ref(src)); char *data; size_t size; diff --git a/lib/remote/httpresponse.cpp b/lib/remote/httpresponse.cpp index 870e91e73..587b58747 100644 --- a/lib/remote/httpresponse.cpp +++ b/lib/remote/httpresponse.cpp @@ -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(boost::ref(src)); + m_ChunkContext = std::make_shared(std::ref(src)); char *data; size_t size;