src/node/ipv4-address-generator.cc
changeset 3007 364e3943c8f0
parent 2983 e3a416fe9dd5
child 3179 1763f7ac8e80
--- a/src/node/ipv4-address-generator.cc	Wed May 07 11:33:40 2008 -0700
+++ b/src/node/ipv4-address-generator.cc	Wed May 07 14:24:45 2008 -0700
@@ -262,12 +262,10 @@
 
   NS_ASSERT_MSG (addr, "Ipv4AddressGeneratorImpl::Add(): "
     "Allocating the broadcast address is not a good idea"); 
-
-  std::list<Entry>::iterator i, j;
+ 
+  std::list<Entry>::iterator i;
 
-  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 @@
 //
       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 @@
 // 
       if (addr == (*i).addrHigh + 1)
         {
+          std::list<Entry>::iterator j = i;
+          ++j;
+
           if (j != m_entries.end ())
             {
               if (addr == (*j).addrLow)