security: move shared_ptr<PibImpl> when possible
Also rename m_impl to m_pib, since it's not a pimpl pointer.
Change-Id: I9e10ada54332318154374f61df6e387348ccc60a
diff --git a/src/security/pib/key-container.cpp b/src/security/pib/key-container.cpp
index 4084cd3..7dc8358 100644
--- a/src/security/pib/key-container.cpp
+++ b/src/security/pib/key-container.cpp
@@ -71,7 +71,7 @@
bool isOtherEnd = other.m_container == nullptr || other.m_it == other.m_container->m_keyNames.end();
return ((isThisEnd || isOtherEnd) ?
(isThisEnd == isOtherEnd) :
- m_container->m_impl == other.m_container->m_impl && m_it == other.m_it);
+ m_container->m_pib == other.m_container->m_pib && m_it == other.m_it);
}
bool
@@ -80,12 +80,12 @@
return !(*this == other);
}
-KeyContainer::KeyContainer(const Name& identity, shared_ptr<PibImpl> impl)
+KeyContainer::KeyContainer(const Name& identity, shared_ptr<PibImpl> pibImpl)
: m_identity(identity)
- , m_impl(impl)
+ , m_pib(std::move(pibImpl))
{
- BOOST_ASSERT(impl != nullptr);
- m_keyNames = impl->getKeysOfIdentity(identity);
+ BOOST_ASSERT(m_pib != nullptr);
+ m_keyNames = m_pib->getKeysOfIdentity(identity);
}
KeyContainer::const_iterator
@@ -121,7 +121,7 @@
}
m_keyNames.insert(keyName);
- m_keys[keyName] = shared_ptr<detail::KeyImpl>(new detail::KeyImpl(keyName, key, keyLen, m_impl));
+ m_keys[keyName] = shared_ptr<detail::KeyImpl>(new detail::KeyImpl(keyName, key, keyLen, m_pib));
return get(keyName);
}
@@ -136,7 +136,7 @@
m_keyNames.erase(keyName);
m_keys.erase(keyName);
- m_impl->removeKey(keyName);
+ m_pib->removeKey(keyName);
}
Key
@@ -154,7 +154,7 @@
key = it->second;
}
else {
- key = shared_ptr<detail::KeyImpl>(new detail::KeyImpl(keyName, m_impl));
+ key = shared_ptr<detail::KeyImpl>(new detail::KeyImpl(keyName, m_pib));
m_keys[keyName] = key;
}
@@ -164,7 +164,7 @@
bool
KeyContainer::isConsistent() const
{
- return m_keyNames == m_impl->getKeysOfIdentity(m_identity);
+ return m_keyNames == m_pib->getKeysOfIdentity(m_identity);
}
} // namespace pib