Skip to content

Commit

Permalink
Fix typo (envoyproxy#14716)
Browse files Browse the repository at this point in the history
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
  • Loading branch information
hs0210 authored Jan 15, 2021
1 parent 18db4c9 commit 1d1b708
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions source/common/init/target_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Envoy {
namespace Init {

TargetHandleImpl::TargetHandleImpl(absl::string_view handle_name, absl::string_view name,
std::weak_ptr<InternalInitalizeFn> fn)
std::weak_ptr<InternalInitializeFn> fn)
: handle_name_(handle_name), name_(name), fn_(std::move(fn)) {}

bool TargetHandleImpl::initialize(const Watcher& watcher) const {
Expand All @@ -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<InternalInitalizeFn>([this, fn](WatcherHandlePtr watcher_handle) {
fn_(std::make_shared<InternalInitializeFn>([this, fn](WatcherHandlePtr watcher_handle) {
watcher_handle_ = std::move(watcher_handle);
fn();
})) {}
Expand All @@ -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<InternalInitalizeFn>(fn_)));
new TargetHandleImpl(handle_name, name_, std::weak_ptr<InternalInitializeFn>(fn_)));
}

bool TargetImpl::ready() {
Expand All @@ -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<InternalInitalizeFn>([this, fn](WatcherHandlePtr watcher_handle) {
fn_(std::make_shared<InternalInitializeFn>([this, fn](WatcherHandlePtr watcher_handle) {
if (initialized_) {
watcher_handle->ready();
} else {
Expand All @@ -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<InternalInitalizeFn>(fn_)));
new TargetHandleImpl(handle_name, name_, std::weak_ptr<InternalInitializeFn>(fn_)));
}

bool SharedTargetImpl::ready() {
Expand Down
10 changes: 5 additions & 5 deletions source/common/init/target_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ using InitializeFn = std::function<void()>;
* 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<void(WatcherHandlePtr)>;
using InternalInitializeFn = std::function<void(WatcherHandlePtr)>;

/**
* A TargetHandleImpl functions as a weak reference to a TargetImpl. It is how a ManagerImpl safely
Expand All @@ -32,7 +32,7 @@ class TargetHandleImpl : public TargetHandle, Logger::Loggable<Logger::Id::init>
friend class SharedTargetImpl;

TargetHandleImpl(absl::string_view handle_name, absl::string_view name,
std::weak_ptr<InternalInitalizeFn> fn);
std::weak_ptr<InternalInitializeFn> fn);

public:
// Init::TargetHandle
Expand All @@ -48,7 +48,7 @@ class TargetHandleImpl : public TargetHandle, Logger::Loggable<Logger::Id::init>
const std::string name_;

// The target's callback function, only called if the weak pointer can be "locked"
const std::weak_ptr<InternalInitalizeFn> fn_;
const std::weak_ptr<InternalInitializeFn> fn_;
};

/**
Expand Down Expand Up @@ -86,7 +86,7 @@ class TargetImpl : public Target, Logger::Loggable<Logger::Id::init> {
WatcherHandlePtr watcher_handle_;

// The callback function, called via TargetHandleImpl by the manager
const std::shared_ptr<InternalInitalizeFn> fn_;
const std::shared_ptr<InternalInitializeFn> fn_;
};

/**
Expand Down Expand Up @@ -124,7 +124,7 @@ class SharedTargetImpl : public Target, Logger::Loggable<Logger::Id::init> {
std::vector<WatcherHandlePtr> watcher_handles_;

// The callback function, called via TargetHandleImpl by the manager
const std::shared_ptr<InternalInitalizeFn> fn_;
const std::shared_ptr<InternalInitializeFn> fn_;

// The state so as to signal the manager when a ready target is added.
bool initialized_{false};
Expand Down

0 comments on commit 1d1b708

Please sign in to comment.