From 58ab30c53c2cf941e79d386d5c2881104f86c927 Mon Sep 17 00:00:00 2001 From: Craig Dowell Date: Wed, 7 May 2008 14:24:45 -0700 Subject: [PATCH] fix optimized build, bug 169 --- src/core/log.h | 3 +++ src/node/ipv4-address-generator.cc | 18 ++++++++++-------- src/simulator/simulator.cc | 4 ++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/core/log.h b/src/core/log.h index 767aed22d..fd87ace1a 100644 --- a/src/core/log.h +++ b/src/core/log.h @@ -374,6 +374,9 @@ public: #define LogComponentDisableAll(level) #define LogRegisterTimePrinter(printer) +#define LogSetTimePrinter(printer) +#define LogGetTimePrinter + #endif /* LOG_ENABLE */ #endif // __LOG_H__ diff --git a/src/node/ipv4-address-generator.cc b/src/node/ipv4-address-generator.cc index 527425b25..dd1647352 100644 --- a/src/node/ipv4-address-generator.cc +++ b/src/node/ipv4-address-generator.cc @@ -262,12 +262,10 @@ Ipv4AddressGeneratorImpl::AddAllocated (const Ipv4Address address) NS_ASSERT_MSG (addr, "Ipv4AddressGeneratorImpl::Add(): " "Allocating the broadcast address is not a good idea"); + + std::list::iterator i; - std::list::iterator i, j; - - for (i = m_entries.begin (), j = m_entries.begin (), ++j; - i != m_entries.end (); - ++i, ++j) + for (i = m_entries.begin (); i != m_entries.end (); ++i) { NS_LOG_LOGIC ("examine entry: " << Ipv4Address ((*i).addrLow) << " to " << Ipv4Address ((*i).addrHigh)); @@ -277,11 +275,12 @@ Ipv4AddressGeneratorImpl::AddAllocated (const Ipv4Address address) // if (addr >= (*i).addrLow && addr <= (*i).addrHigh) { - NS_LOG_LOGIC ("Ipv4AddressGeneratorImpl::Add(): Address Collision: " << Ipv4Address (addr)); + NS_LOG_LOGIC ("Ipv4AddressGeneratorImpl::Add(): " + "Address Collision: " << Ipv4Address (addr)); if (!m_test) { - NS_ASSERT_MSG (0, - "Ipv4AddressGeneratorImpl::Add(): Address Collision: " << Ipv4Address (addr)); + NS_ASSERT_MSG (0, "Ipv4AddressGeneratorImpl::Add(): " + "Address Collision: " << Ipv4Address (addr)); } return false; } @@ -303,6 +302,9 @@ Ipv4AddressGeneratorImpl::AddAllocated (const Ipv4Address address) // if (addr == (*i).addrHigh + 1) { + std::list::iterator j = i; + ++j; + if (j != m_entries.end ()) { if (addr == (*j).addrLow) diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index 27ac0a26c..f2182903e 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -437,7 +437,9 @@ Simulator::GetPriv (void) m_priv = CreateObject (); Ptr scheduler = CreateObject (); m_priv->SetScheduler (scheduler); +#ifdef NS3_LOG_ENABLE LogSetTimePrinter (&TimePrinter); +#endif /* NS3_LOG_ENABLE */ } TRACE_S ("priv " << m_priv); return m_priv; @@ -455,7 +457,9 @@ Simulator::Destroy (void) * Simulator::GetPriv will trigger again an infinite recursion until the stack * explodes. */ +#ifdef NS3_LOG_ENABLE LogSetTimePrinter (0); +#endif /* NS3_LOG_ENABLE */ m_priv->Destroy (); m_priv = 0; }