table: Pit::deleteInOutRecords accepts Entry* instead of shared_ptr
refs #3164
Change-Id: I512da6200d4d744d5631fc78900795d19ad5dd52
diff --git a/daemon/table/cleanup.cpp b/daemon/table/cleanup.cpp
index c31ccc4..104bdf1 100644
--- a/daemon/table/cleanup.cpp
+++ b/daemon/table/cleanup.cpp
@@ -40,7 +40,7 @@
}
for (const auto& pitEntry : nte.getPitEntries()) {
- pit.deleteInOutRecords(pitEntry, face);
+ pit.deleteInOutRecords(pitEntry.get(), face);
}
if (!nte.hasTableEntries()) {
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index 91bc5a8..8fc78bf 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -28,6 +28,12 @@
namespace nfd {
namespace pit {
+static inline bool
+nteHasPitEntries(const name_tree::Entry& nte)
+{
+ return nte.hasPitEntries();
+}
+
Pit::Pit(NameTree& nameTree)
: m_nameTree(nameTree)
, m_nItems(0)
@@ -85,8 +91,7 @@
DataMatchResult
Pit::findAllDataMatches(const Data& data) const
{
- auto&& ntMatches = m_nameTree.findAllMatches(data.getName(),
- [] (const name_tree::Entry& entry) { return entry.hasPitEntries(); });
+ auto&& ntMatches = m_nameTree.findAllMatches(data.getName(), &nteHasPitEntries);
DataMatchResult matches;
for (const name_tree::Entry& nte : ntMatches) {
@@ -113,7 +118,7 @@
}
void
-Pit::deleteInOutRecords(shared_ptr<Entry> entry, const Face& face)
+Pit::deleteInOutRecords(Entry* entry, const Face& face)
{
BOOST_ASSERT(entry != nullptr);
@@ -126,8 +131,7 @@
Pit::const_iterator
Pit::begin() const
{
- return const_iterator(m_nameTree.fullEnumerate(
- [] (const name_tree::Entry& entry) { return entry.hasPitEntries(); }).begin());
+ return const_iterator(m_nameTree.fullEnumerate(&nteHasPitEntries).begin());
}
} // namespace pit
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index 3f49737..91e958e 100644
--- a/daemon/table/pit.hpp
+++ b/daemon/table/pit.hpp
@@ -95,7 +95,7 @@
/** \brief deletes in-record and out-record for face
*/
void
- deleteInOutRecords(shared_ptr<Entry> entry, const Face& face);
+ deleteInOutRecords(Entry* entry, const Face& face);
public: // enumeration
typedef Iterator const_iterator;