Avoid ABI differences between debug/optimized modes
Change-Id: I1ef385b9998303b95495718ff1f52d26a589ea24
Refs: #4496
diff --git a/src/logic.cpp b/src/logic.cpp
index c83132c..84cf5be 100644
--- a/src/logic.cpp
+++ b/src/logic.cpp
@@ -30,11 +30,7 @@
INIT_LOGGER(Logic);
-#ifdef _DEBUG
#define _LOG_DEBUG_ID(v) _LOG_DEBUG("Instance" << m_instanceId << ": " << v)
-#else
-#define _LOG_DEBUG_ID(v) _LOG_DEBUG(v)
-#endif
namespace chronosync {
@@ -47,9 +43,7 @@
0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55
};
-#ifdef _DEBUG
int Logic::s_instanceCounter = 0;
-#endif
const ndn::Name Logic::DEFAULT_NAME;
const ndn::Name Logic::EMPTY_NAME;
@@ -96,16 +90,12 @@
, m_syncReplyFreshness(syncReplyFreshness)
, m_recoveryInterestLifetime(recoveryInterestLifetime)
, m_validator(validator)
+ , m_instanceId(s_instanceCounter++)
{
-#ifdef _DEBUG
- m_instanceId = s_instanceCounter++;
-#endif
-
_LOG_DEBUG_ID(">> Logic::Logic");
addUserNode(m_defaultUserPrefix, defaultSigningId);
-
m_syncReset = m_syncPrefix;
m_syncReset.append("reset");
diff --git a/src/logic.hpp b/src/logic.hpp
index b3e0fe6..f1f6a0e 100644
--- a/src/logic.hpp
+++ b/src/logic.hpp
@@ -521,10 +521,8 @@
ndn::KeyChain m_keyChain;
std::shared_ptr<Validator> m_validator;
-#ifdef _DEBUG
int m_instanceId;
static int s_instanceCounter;
-#endif
};
diff --git a/src/socket.cpp b/src/socket.cpp
index 6ec9c41..a4c1673 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -48,11 +48,13 @@
, m_signingId(signingId)
, m_validator(validator)
{
+ NDN_LOG_DEBUG(">> Socket::Socket");
if (m_userPrefix != DEFAULT_NAME)
m_registeredPrefixList[m_userPrefix] =
m_face.setInterestFilter(m_userPrefix,
bind(&Socket::onInterest, this, _1, _2),
[] (const Name& prefix, const std::string& msg) {});
+ NDN_LOG_DEBUG("<< Socket::Socket");
}
Socket::~Socket()
@@ -70,6 +72,8 @@
if (prefix == DEFAULT_NAME)
return;
+ NDN_LOG_DEBUG(">> addSyncNode");
+
auto itr = m_registeredPrefixList.find(prefix);
if (itr != m_registeredPrefixList.end())
return;
@@ -81,6 +85,7 @@
m_face.setInterestFilter(prefix,
bind(&Socket::onInterest, this, _1, _2),
[] (const Name& prefix, const std::string& msg) {});
+ NDN_LOG_DEBUG("<< addSyncNode");
}
void
@@ -208,8 +213,8 @@
void
Socket::onInterest(const Name& prefix, const Interest& interest)
{
- shared_ptr<const Data>data = m_ims.find(interest);
- if (static_cast<bool>(data)) {
+ shared_ptr<const Data> data = m_ims.find(interest);
+ if (data != nullptr) {
m_face.put(*data);
}
}