diff --git a/source/common/init/target_impl.cc b/source/common/init/target_impl.cc index 8ee37eabfd14..4e3fda44b6a0 100644 --- a/source/common/init/target_impl.cc +++ b/source/common/init/target_impl.cc @@ -4,7 +4,7 @@ namespace Envoy { namespace Init { TargetHandleImpl::TargetHandleImpl(absl::string_view handle_name, absl::string_view name, - std::weak_ptr fn) + std::weak_ptr fn) : handle_name_(handle_name), name_(name), fn_(std::move(fn)) {} bool TargetHandleImpl::initialize(const Watcher& watcher) const { @@ -26,7 +26,7 @@ absl::string_view TargetHandleImpl::name() const { return name_; } TargetImpl::TargetImpl(absl::string_view name, InitializeFn fn) : name_(fmt::format("target {}", name)), - fn_(std::make_shared([this, fn](WatcherHandlePtr watcher_handle) { + fn_(std::make_shared([this, fn](WatcherHandlePtr watcher_handle) { watcher_handle_ = std::move(watcher_handle); fn(); })) {} @@ -38,7 +38,7 @@ absl::string_view TargetImpl::name() const { return name_; } TargetHandlePtr TargetImpl::createHandle(absl::string_view handle_name) const { // Note: can't use std::make_unique here because TargetHandleImpl ctor is private. return TargetHandlePtr( - new TargetHandleImpl(handle_name, name_, std::weak_ptr(fn_))); + new TargetHandleImpl(handle_name, name_, std::weak_ptr(fn_))); } bool TargetImpl::ready() { @@ -54,7 +54,7 @@ bool TargetImpl::ready() { SharedTargetImpl::SharedTargetImpl(absl::string_view name, InitializeFn fn) : name_(fmt::format("shared target {}", name)), - fn_(std::make_shared([this, fn](WatcherHandlePtr watcher_handle) { + fn_(std::make_shared([this, fn](WatcherHandlePtr watcher_handle) { if (initialized_) { watcher_handle->ready(); } else { @@ -70,7 +70,7 @@ absl::string_view SharedTargetImpl::name() const { return name_; } TargetHandlePtr SharedTargetImpl::createHandle(absl::string_view handle_name) const { // Note: can't use std::make_unique here because TargetHandleImpl ctor is private. return TargetHandlePtr( - new TargetHandleImpl(handle_name, name_, std::weak_ptr(fn_))); + new TargetHandleImpl(handle_name, name_, std::weak_ptr(fn_))); } bool SharedTargetImpl::ready() { diff --git a/source/common/init/target_impl.h b/source/common/init/target_impl.h index da7281c69b2f..9cc0bac76c11 100644 --- a/source/common/init/target_impl.h +++ b/source/common/init/target_impl.h @@ -20,7 +20,7 @@ using InitializeFn = std::function; * and resets it later in `ready`. Users needn't care about this implementation detail, they only * need to provide an `InitializeFn` above when constructing a target. */ -using InternalInitalizeFn = std::function; +using InternalInitializeFn = std::function; /** * A TargetHandleImpl functions as a weak reference to a TargetImpl. It is how a ManagerImpl safely @@ -32,7 +32,7 @@ class TargetHandleImpl : public TargetHandle, Logger::Loggable friend class SharedTargetImpl; TargetHandleImpl(absl::string_view handle_name, absl::string_view name, - std::weak_ptr fn); + std::weak_ptr fn); public: // Init::TargetHandle @@ -48,7 +48,7 @@ class TargetHandleImpl : public TargetHandle, Logger::Loggable const std::string name_; // The target's callback function, only called if the weak pointer can be "locked" - const std::weak_ptr fn_; + const std::weak_ptr fn_; }; /** @@ -86,7 +86,7 @@ class TargetImpl : public Target, Logger::Loggable { WatcherHandlePtr watcher_handle_; // The callback function, called via TargetHandleImpl by the manager - const std::shared_ptr fn_; + const std::shared_ptr fn_; }; /** @@ -124,7 +124,7 @@ class SharedTargetImpl : public Target, Logger::Loggable { std::vector watcher_handles_; // The callback function, called via TargetHandleImpl by the manager - const std::shared_ptr fn_; + const std::shared_ptr fn_; // The state so as to signal the manager when a ready target is added. bool initialized_{false};